[英]Saving reordering cells in UITableViewController with Core Data
我正在尋找使用 Core Data 在UITableViewController
中保存重新排序單元格的簡單實現。
現在我使用默認的 function 重新排序單元格:
var timers: [Timers] = []
override func tableView(_ tableView: UITableView, moveRowAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) {
let movedObject = timers[sourceIndexPath.row]
timers.remove(at: sourceIndexPath.row)
timers.insert(movedObject, at: destinationIndexPath.row)
}
如何實現 Core Data 以保存單元格排序功能?
每次離開該 vc 時,您都需要在deinit
中重新保存數組
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.