-2

Is there a way to create an NSObject and set values for it in one view controller, and get them back in another view controller by looking for the existing instance of that NSObject?

Much like AppDelegate has its sharedInstance that you can access from anywhere and thus put values into it from anywhere?

I created a view controller that instantiates my model object and fills its properties. How do I access that instance of the model object from another view controller?

I'm not asking how to pass data in a view controller that calls another view controller. I know how to do that. I'm asking how to set values to a model object from different, unrelated and hierarchically independent view controllers.

marciokoko
  • 4,988
  • 8
  • 51
  • 91
  • All those examples pass data to and from VC. I'm capturing data in a vc but trying to store it in a custom NSObject. – marciokoko Feb 11 '13 at 16:45
  • 1
    Passing, storing; it's the same thing. – trojanfoe Feb 11 '13 at 16:47
  • Oh, what I meant is, I'm in a tabbar controller, so there is no sequence from one vc to another. I wish to receive data in a tab and have it available in another tab. – marciokoko Feb 11 '13 at 16:54

1 Answers1

0

If I understand you question correctly, what you are looking for is Key Value Observation. It is commonly used to decouple the controller layer from the model layer (as in MVC, Model View Controller).

tuscland
  • 806
  • 7
  • 15