我有一个UITableView需要在某些情况下(并非总是)在顶部插入某些东西。Table HeaderView iPhone
代码(如果它是一个或正常)细胞将如下
UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,98,100)];
imgView.image = [UIImage imageNamed:@"image.png"];
cell.imageView.image = imgView.image;
//sets cell text
cell.textLabel.text = @"Number";
,但我在这里告诉上,这将是更容易实现headerView比每次改变indexPath。
所以我的问题是我将如何实现这个?我会使用- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
还是使用- (NSString *)tableView:(UITableView *)aTableView titleForHeaderInSection:(NSInteger)section
?请记住,我有一个图像放入单元格(headerView)。
感谢