我不明白这个insertRowsAtIndexPaths用法.我需要reloadData为这项工作制作一张桌面视图吗?
如果不进行reloadData应用程序崩溃.
应用程序崩溃,因为在insertRows调用之前和之后数据源不一致.
例如,如果要插入一个新行,则需要tableView:numberOfRowsInSection:在插入调用之前返回1行.
这是一个展示的例子
self.numberOfRows = self.numberOfRows + 1;
[self.tableView insertRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:0 inSection:0]] withRowAnimation:UITableViewRowAnimationAutomatic];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6299 次 |
| 最近记录: |