你好,我有一个 tableview,里面有很多对象。如果我想在其中添加一行而不重新加载整个表格。因为cell中有一些进程。有人可以帮忙吗?
最佳答案
你可以通过两种方式做到这一点 -
[tableView beginUpdates];
[tableView insertRowsAtIndexPaths:newResults withRowAnimation:UITableViewRowAnimationNone];
[tableView endUpdates];
或
[tableView insertRowsAtIndexPaths:newResults withRowAnimation:UITableViewRowAnimationNone];
此处 newResults
是您需要创建的 NSIndexPath
的 NSArray
。然后在这些行中插入新行(有或没有动画)。
关于iphone - 插入行而不重新加载表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8655258/