@interface RootTableViewController : UITableViewController
@property (strong,nonatomic) NSArray *arrTitle;
@property (strong,nonatomic) NSArray *arrImages;
@end
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"我";
self.arrTitle = @[@"相册",@"收藏",@"钱包",@"卡包"];
self.arrImages = @[@"[email protected]",@"[email protected]",@"[email protected]",@"PayCarddetailVirtualIcon.png"];
[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"reuseIdentifier"];
//锁定
self.tableView.scrollEnabled = NO;
//设置前景色
self.navigationController.navigationBar.barTintColor = [UIColor grayColor];
//设置字体颜色及字体大小
[self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor],NSFontAttributeName:[UIFont systemFontOfSize:20 weight:10]}];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 4;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if (section == 0) {
return 1;
}
else if (section == 1){
return 4;
}
else{
return 1;
}
return 0;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"reuseIdentifier" forIndexPath:indexPath];
if (indexPath.section == 0) {
cell.textLabel.numberOfLines = 2;
cell.textLabel.text = @"XXX \r\n 微信号是:lanco";
cell.imageView.image = [UIImage imageNamed:@"a.jpeg"];
}
else if (indexPath.section == 1){
cell.textLabel.text = self.arrTitle[indexPath.row];
cell.imageView.image = [UIImage imageNamed:self.arrImages[indexPath.row]];
}
else if (indexPath.section == 2){
cell.textLabel.text = @"表情";
cell.imageView.image = [UIImage imageNamed:@"MoreExpressionShops"];
}
else
{
cell.textLabel.text = @"设置";
cell.imageView.image = [UIImage imageNamed:@"MoreSetting"];
}
if (indexPath.section == 0) {
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(self.view.frame.size.width - 60, 30, 25, 20)];
imageView.image = [UIImage imageNamed:@"add_friend_myQR"];
[cell.contentView addSubview:imageView];
}
else{
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section == 0) {
return 80;
}
else{
return 40;
}
}