在视图控制器之间传递数据 - Passing data between view controllers

问题:

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视图上,我启用了多个选择。

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 I 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
参考二: Passing data between view controllers
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章