title: iOS - Init View Controllers in Tab Bar
body: <p>I'm working on a project with two tabs. On my First View Controller I'm attempting to call a method that's located in my Second View Controller. The method on the Second View Controller updates a UILabel on this Second View Controller. The problem is the Second View Controller doesn't init on launch therefore the method isn't properly called. I can use the following to manually init the Second View Controller </p>
  
  <pre><code>     if (secondView==nil) {
          secondView = [[SecondView alloc]init];
      }
  </code></pre>
  
  <p>and then the method is launched (tested by placing a breakpoint on said method and verified that it does trigger), but my UILabel doesn't update, which leads me to believe that the Second View Controller is initialized on a different thread.</p>
  
  <p>My question is: How do I initialize the Second View controller on the same thread so that the UI will update when I click over to that tab? Is there a way to do this in the appDelegate
  ?</p>
  
  <p>I've verified that the IBOutlet is wired to the label properly, .h file is imported properly, and method for SecondViewController is stated in the .H file.</p>
  
  <p>Code is listed below:</p>
  
  <pre><code>FirstViewController.m
  
  -(void)myMethod
  {
       [secondView updateLabel];
  }
  
  SecondViewController.m
  -(void)updateLabel
  {
      myLabel.text = myString;
  }
  </code></pre>