![](/img/trans.png)
[英]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.