title: Access TabBarController variables in sub-ViewController
body: <p>Basically, I have a TabBarController and some sub-views attached to this controller. The TabBarController has some properties that I would like to access in the sub-views.</p>
  
  <p>Here's what I have :</p>
  
  <p>MyTabBarController's .m</p>
  
  <pre><code>-(void)setDetails:(id)sender
  {
      self.myVariable = @"This is a test";
      NSLog(@"Here I set my variable");
  }
  
  - (void)viewDidLoad
  {
      NSLog(@"[LOAD] My Tab Bar Controller");
      [self setDetails:nil];
  }
  </code></pre>
  
  <p>First subView's .m</p>
  
  <pre><code>- (void)viewDidLoad
  {
      NSLog(@"[LOAD] FirstViewController");
  
      MyTabBarController *myTBC = (MyTabBarController *)self.tabBarController;
      self.headerName.text = myTBC.myViariable; // Here I just set the UILabel's text
      NSLog(@"Header name = %@", self.headerName);
  }
  </code></pre>
  
  <p>Here's what I have in the logs :</p>
  
  <pre><code>2012-08-07 11:43:23.001 MyFirstproject[23632:15203] [LOAD] My Tab Bar Controller
  2012-08-07 11:43:23.012 MyFirstproject[23632:15203] [LOAD] FirstViewController
  2012-08-07 11:43:23.072 MyFirstproject[23751:15203] Header name = (null)
  2012-08-07 11:43:23.116 MyFirstproject[23751:15203] Here I set my variable
  </code></pre>
  
  <p>My question is : As I can see in the logs, the <code>viewDidLoad</code> function of MyTabBarController is called <strong>before</strong> the FirstViewController's one. However, it seems the function <code>setDetails</code> of MyTabBarController is called <strong>after</strong> the function <code>viewDidLoad</code> of the FirstViewController.</p>
  
  <p>How can this be possible ? Is there something I'm doing wrong here ?</p>
  
  <p>Thanks !</p>