我有一個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)。
感謝