<分区>
<分区>
我正在使用 Storyboard构建 iOS 应用程序。
我有一个 TableView ,用于显示来自数据库的多个数据。
我也在使用下拉刷新。
在 PullDownRefresh 中,我调用了一个方法 [(void)updateData],我在其中重新加载了 tableview。
此时单元格中的图像在滚动时突然闪烁。
所以我不想重新加载 tableView,而是想更新 tableView。
这意味着我想从最后一个单元格添加新行。
我是 iOS 初学者。感谢帮助。
最佳答案
您可以使用 UITableView 的 insertRowsAtIndexPaths-
dispatch_async(dispatch_get_main_queue(), ^{
[self.tableView beginUpdates];
[self.tableDatalist insertObject:obj atIndex:index];
[self.tableView insertRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:index inSection:0]]
withRowAnimation:UITableViewRowAnimationRight];
[self.tableView endUpdates];
});
关于ios - 如何更新 tableview 单元格而不是重新加载?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30888893/
相关文章:
ios - 自动调整 UITableView 中嵌入的 UICollectionView 单元格大小不起作用
swift - 将信息从字典推送到 UITextField (Swift)
ios - 继续错误 "Ambigious Reference to member ' tableView'“Swift
swift - 如何从同一目标内的不同 .swift 文件访问 iVar?
ios - 类型 'MapViewController' 没有成员 'mapTypeChanged' Swift Big Nerd Ranch Guide
ios - 如何更改 UITableView 的高度以适应其动态内容?