Home Passing Data between View Controllers
Reply: 0

Passing Data between View Controllers

user9055 Published in September 19, 2018, 7:11 pm

I'm new to iOS and Objective-C and the whole MVC paradigm and I'm stuck with the following:

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.

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?

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.

What would be the correct way of performing this and how would I go about it?

share|improve this question
  • @Wain, what's with the meta tag? – Charles Jan 30 '14 at 18:28
  • @Charles, this question is an example of people having issues with class interaction / relationships. This happens quite a bit and is usually misrepresented and tagged as language / IDE. It's an attempt to group this kind of problem to aid with identification. Not worthwhile? – Wain Jan 30 '14 at 18:36
  • 3
    @Charles, fair point, it is often related to people's understanding of instances as well as the relationships which also leans towards an oop tag. – Wain Jan 30 '14 at 18:53
  • This is a question that puts people off, from actually using this method. For example i know a few people who do all the thing from the same view controller cause they can't use prepareForSegue! it gets messy – Xcoder Oct 2 '14 at 5:36

39 Answers 39

active oldest votes
1 2 next
up vote 119 down vote
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.533351 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO