Quote:
Originally Posted by sajaz
Im quite new to iphone development, I want to create a mutable array which can access and populate from different view controllers. How can I do it? If you can please give me a sample code
thanks in advanced.
|
The cleanest way to share data between objects in your app is to create a data container singleton. A singleton is an object that gets created once and only once, and is accessible across your entire project. Cocoa uses singletons all over the place. Objects like standardUserDefaults, the file manager, and many others are singletons.
A data container singleton is simply a singleton object that has properties for the values that you want to share.
Take a look at the password generator app referenced in my signature. That app is a working example that uses a data container singleton (albeit in a trivially simple way.)