[英]Swift iOS -How to change TableView Cell Properties for All Visible Cells Already Loaded On Screen Without Reloading Data?
[英]Without reloading Tableview, update the changed index cell values using Observer in iOS Swift
但是如果会更改数据堆栈中的某些 indexPaths,您应该小心,如果它会发生 - 使用tableView.deleteRows
或tableView.deleteSections
。 此更新在表和 dataStack 或crash
中应该是合格的
let indexPaths = [IndexPath]()
tableView.performBatchUpdates {
self.tableView.reloadRows(at: indexPaths, with: .none)
}
或者
tableView.beginUpdates()
tableView.reloadRows(at: indexPaths, with: .none)
tableView.endUpdates()
顺便说一句,你可以让你的 indexPaths 像let indexPaths = tableView.indexPathsForVisibleRows
一样更新 - 方法的名字很有趣,如果你有套接字我想它会有所帮助,因为你有动态
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.