PDA

View Full Version : Passing variables between views in Tab Bar Controller




dusker
Dec 9, 2009, 05:48 PM
Hi,

i'm having a problem with passing variables among ViewControllers in tab bar controller.
I've built an app using tab bar template. I've created several tabs (each one got viewcotroller and xib linked). UI works ok. BUT one of the views generate an NSMutableArray that needs to be passed over to another view.
And here's my problem, i don't know how to reference that NSMutableArray that has been generated in that other viewcontroller.
Could anyone help?

thanks
peter



drf1229
Dec 9, 2009, 06:58 PM
What you need is to connect the views with IBOutlets. Once thats done, you need to make the variables you want into properties in the views you want.

North Bronson
Dec 9, 2009, 07:07 PM
Is each view controller a direct subclass of UIViewController, or are there a couple of UINavigationControllers thrown in?

dusker
Dec 10, 2009, 04:08 AM
Thanks for help, i figured it out myself finally.
Inside a viewcontroller that is managed by tab bar you can reference any other by

self.tabBarController.viewControllers - it's an array of viewController instances.