[英]Swift: How to SHIFT data from one view controller to another when the user taps on the Tableview Cell
I am working on a To-Do List App. 我正在开发待办事项清单应用程序。 I am using a tabbed application which has two tabs, One for "pending" tasks and other for "Done" tasks.
我正在使用一个选项卡式应用程序,其中有两个选项卡,一个用于“待处理”任务,另一个用于“完成”任务。 Both the view controllers have UITableview.
两个视图控制器都具有UITableview。 When the user taps on a task/cell in Pending Tasks tab, the task is considered done and it is shifted to the "Done" tasks tab.
当用户在“挂起的任务”选项卡中点击任务/单元时,该任务被视为已完成,并且将其移至“完成”任务选项卡。 Can someone help me on how do I perform this operation.
有人可以帮助我如何执行此操作。
I would really glad if someone can also help me with this task as well, As soon as the task is shifted to the Done task, How do I display a "Undo" button on the cell for 5 secs just like in gmail app when an email is deleted. 如果有人也可以帮助我完成此任务,我将非常高兴。一旦任务转移到“完成”任务,我如何像在gmail应用程序中一样在单元格上显示“撤消”按钮5秒钟,电子邮件被删除。 Thanks in advance.
提前致谢。
In this case it's a matter of managing your data model. 在这种情况下,只需要管理数据模型即可。 When you select the item in pending and it is considered complete, you update your data model to change that item to be completed from pending.
当您选择待处理的项目并将其视为完成时,您将更新数据模型以将该项目更改为待处理。 Then you either reload the tableview or the row for the change to take affect in your tableview..
然后,您可以重新加载表视图或行以使更改在表视图中生效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.