[英]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.