1
我正在处理一个tableview,在其单元格中显示多行文本。我想要两个部分,我已经完成了。但是在第二部分显示另一个数组是否可能不一样?牛逼关于分割你的UITableView
这是我使用的代码:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if (section == 0) {
return MIN([titles count], [subtitles count]);
}
else {
return 1;
}
}
我不得不改变的cellForRowAtIndexPath到\t'如果(indexPath.section == 0) \t { \t \t cell.textLabel.text = [标题objectAtIndex:indexPath.row]; \t \t cell.detailTextLabel.text = [subtitles objectAtIndex:indexPath.row]; \t} \t别的 \t \t如果(indexPath.section == 1) \t \t { \t \t \t cell.textLabel.text = [titles2 objectAtIndex:indexPath.row]; \t \t \t cell.detailTextLabel.text = [subtitles2 objectAtIndex:indexPath.row]; \t \t} \t \t return cell; '但现在一切正常。谢谢:) – mstottrop 2011-04-03 12:08:22
多数民众赞成在我的意思是'只要确保在所有UITableViewDataSource和UITableViewDelegate方法切换数组.' :-) – 2011-04-03 12:42:31