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