【发布时间】:2014-03-18 03:03:17
【问题描述】:
您好,我有一个问题,如果我在 uitableview 中添加超过 13 个项目,这些项目会重复
这是我的代码
添加:
[categoryList insertObject:inputcategory atIndex:0];
NSIndexPath *indexpath = [NSIndexPath indexPathForRow:0 inSection:0];
[self.tableView insertRowsAtindexPaths@[indexpath] withRowAnimation:UITableViewRowAnimationAutomatic];
CellForRow:
if (cell == nil){
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
cell.textlabel.text = [categoryList objectAtIndex:indexPath.row];
}
行数
return [categoryList count];
前 12 个项目还可以,但之后它在我的 uitableview 中再次在我的 NSMutableArray 中添加相同的最后一个对象,当我重新加载它时,它只记录 12 个项目。
【问题讨论】:
标签: ios uitableview nsmutablearray