Is that possible? To reload only the cells that are visible in order to do it more efficient.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
That's how table views work by default. The UITableView
class never loads cells until they're about to appear onscreen, even when you call reloadData
.
回答2:
Try this, You can reload any cell of the tableview using reloadRowsAtIndexPaths:
[self.tableView beginUpdates];
[self.tableView reloadRowsAtIndexPaths:[self.tableView indexPathsForVisibleRows]
withRowAnimation:UITableViewRowAnimationNone];
[self.tableView endUpdates];
回答3:
To reload visible cells of tableview in Swift 3.0:
pTableView.beginUpdates()
pTableView.reloadRows(at:
pMessagesTableView.indexPathsForVisibleRows!, with: .none)
pTableView.endUpdates()