objective c - Object sharing in my iPhone App -
I am currently developing my first iPhone application and I would like to know that the best way to share something What can be used in every controller.
I was thinking of referencing the controller with the necessary data in other controllers and thanks for the use of this data, it is a good idea or a better way to do this << P> < / P>
Post-text "itemprop =" text ">
The question is not clear from what kind of data you deal with, but one method I used in an iPhone application is a single object in which the app Likation State and State Management Function.
There is a good discussion of the use of Singleton vs. App Delegants for this type of data and what I want to say to them here.
For example, in this case a user account was tied to a web application, so when the application loads, the singleton object will be started and when the user signs it, Ject will be kept in singleton so that user information can be referred to API call.
This approach has worked very well for my purposes, you can see that in Objective-C How to create a singleton class, and there are several ways to do this in Apple Docs that provide similar functional results.
Once you have defined your singleton class, you can start it in the app, launch the refinement or view it in the main viewer's viewdial load and manage the data reaching globally. .
If you are stuck, then I can post some examples, I code, but available with examples of available Ekultana class are very easy to work with.