我可以在表视图的不同部分有不同的行配置吗?
问题描述:
我可以在表视图的不同部分有不同的行配置吗?我可以在表视图的不同部分有不同的行配置吗?
此方法不包含部分参数:
-(UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
那么是否有可能在同一个表视图不同部分有什么不同?
答
是的,你可以在不同的视图部分有不同的配置。
其实indexPath.row会给你行索引,indexPath.section会给你索引。
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"You are at row = %d and section = %d",indexPath.row,indexPath.section);
}
取决于这两个索引,你可以指定不同的配置。
Jim。