简体   繁体   English

Swift:当用户点击Tableview单元格时,如何将数据从一个视图控制器转移到另一个

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

相关问题 将数据从 tableview 单元格传递到 View Controller Swift 2.1 - Passing data from tableview cell to View Controller Swift 2.1 从一个视图控制器移动到另一个视图控制器时如何保存tableview数据? - How to save tableview data when moving from one view controller to another? 如何在用户点击静态tableview单元格时启用编辑模式? - How to enable edit mode when user taps static tableview cell? 快速将TableView单元中的数据传递给视图控制器 - Swift Passing Data in a tableview cell to a view controller 如何在用户点击搜索栏swift时显​​示tableview - How to show tableview when user taps searchbar swift 如何在另一个View Controller中使用核心数据编辑Tableview单元格数据 - How To Edit Tableview Cell Data with Core Data In Another View Controller 如何在另一个视图控制器Swift 4中将数据插入到TableView中? - How to insert data to TableView in another view controller Swift 4? 如何快速从另一个视图控制器重新加载 tableview - How to reload tableview from another view controller in swift 当在单元格中按下按钮时,如何将数据从一个 Tableview 传递到另一个 Tableview? - how to pass data from one Tableview to another Tableview when button is pressed in cell? 如何使用SWrevaelviewController swift 3将数据从表视图的特定行传递到另一个视图控制器 - how to pass data from a particular row of a tableview to another view controller using SWrevaelviewController swift 3
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM