我可以在表格视图的不同部分中使用不同的行配置吗?
此方法不包含section参数:
-(UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
那么可以对同一个表视图中的不同部分做不同的操作吗?
答案 0 :(得分:1)
是的,您可以在不同的视图部分中使用不同的配置。
实际上indexPath.row会给你行索引,而indexPath.section会给你一节索引。
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"You are at row = %d and section = %d",indexPath.row,indexPath.section);
}
取决于这两个索引,您可以指定不同的配置。
吉姆。