If I have a tabbed iphone application, how do I communicate from one tab to the next. For example if I have a puzzle game that displays a picture on the 5th tab, but only if the switches on the other 4 tabs are in the right positions, how do i let the 5th tab know what is set on the others?
Share
First, you could store your shared information via a property of your custom tab bar controller that the
viewDidLoadof the individual tabs’ view controllers could retrieve to update their own ivar, e.g.:Second, you could store your model in the app delegate, you could do something like the following in your individual tabs’ view controllers:
Third, you could also presumably use a singleton.
Seems like if your goal is to share information amongst tabs, the first technique seems best (it’s best to limit objects to the narrowest appropriate scope).