如何重新排序 TableView 中的行以及保存在 CoreData 中的更改?

发布于 2025-01-20 09:39:35 字数 719 浏览 1 评论 0原文

我已经搜索了几天的答案,以解决该问题的答案,如何用Swift保存重新订购表?互联网上的许多教程都显示了如何重新排序以及如何与Coredata保存。

这是我的代码。我错了?

请你能帮我解决解决方案吗?非常感谢。

=============================================== ====================================================

 func tableView(_ tableView: UITableView, moveRowAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath)
 { 

     // SecStoredArray = Array name 

     let itemMove = SecStoredArray[sourceIndexPath.row]

     SecStoredArray.remove(at: sourceIndexPath.row)

     SecStoredArray.insert(itemMove, at: destinationIndexPath.row)

}

​=======================================

我正在使用此代码进行重新排序tableview cell这是工作的,但是我有一个问题单元格无法保存在核心数据中,请任何人帮助我?

I search already a few days to the answer on the question how can I save the reorder TableView with Swift? So many tutorials on the internet show how to reorder and how to save with Coredata.

This is my code right now. What do I wrong?

Please can you help me to the solution? Thank you very much.

======================================================================

 func tableView(_ tableView: UITableView, moveRowAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath)
 { 

     // SecStoredArray = Array name 

     let itemMove = SecStoredArray[sourceIndexPath.row]

     SecStoredArray.remove(at: sourceIndexPath.row)

     SecStoredArray.insert(itemMove, at: destinationIndexPath.row)

}

======================================================================

i'm Using this code for reorder TableView Cell It's Work but I have a one problem The Cell value can't Save In core data Please Any one help me ???????

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文