问题:
I'm new to iOS and Objective-C and the whole MVC paradigm and I'm stuck with the following: 我是iOS和Objective-C以及整个MVC范例的新手,但我坚持以下几点:
I have a view that acts as a data entry form and I want to give the user the option to select multiple products. 我有一个充当数据输入表单的视图,我想给用户选择多个产品的选项。 The products are listed on another view with a UITableViewController
and I have enabled multiple selections. 这些产品在另一个带有UITableViewController
视图中列出,并且我启用了多个选择。
My question is, how do I transfer the data from one view to another? 我的问题是,如何将数据从一个视图传输到另一个视图? I will be holding the selections on the UITableView
in an array, but how do I then pass that back to the previous data entry form view so it can be saved along with the other data to Core Data on submission of the form? 我将在数组中的UITableView
上保留选择,但是如何将其传递回先前的数据输入表单视图,以便在提交表单时将其与其他数据一起保存到Core Data?
I have surfed around and seen some people declare an array in the app delegate. 我到处逛逛,看到有人在应用程序委托中声明了一个数组。 I read something about Singletons but don't understand what these are and I read something about creating a data model. 我读了一些有关Singletons的内容,但不了解它们是什么,并且读了一些有关创建数据模型的知识。
What would be the correct way of performing this and how would I go about it? 什么是执行此操作的正确方法,我将如何处理?
解决方案:
参考一: https://stackoom.com/question/LrUt/在视图控制器之间传递数据参考二: https://oldbug.net/q/LrUt/Passing-Data-between-View-Controllers
来源:oschina
链接:https://my.oschina.net/u/4428122/blog/4305898