Passing variables between views in Tab Bar Controller

Discussion in 'iOS Programming' started by dusker, Dec 9, 2009.

  1. dusker macrumors member

    May 31, 2009

    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?

  2. drf1229 macrumors regular


    Jun 22, 2009
    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.
  3. North Bronson macrumors 6502

    Oct 31, 2007
    San José
    Is each view controller a direct subclass of UIViewController, or are there a couple of UINavigationControllers thrown in?
  4. dusker thread starter macrumors member

    May 31, 2009
    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.

Share This Page