title: UItabBar changing View Controllers
body: <p>i have some difficulties changing tab bar controllers. Basically I have UITabBarController with 3 controllers. First time when app starts. I change one controller like this:</p>
  
  <pre><code>NSMutableArray *muteArray = [[NSMutableArray alloc] init];
  FirstPage *online;
  
  if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
  {
  
      online =[[FirstPage alloc] initWithNibName:nil bundle:nil];
  
  
  }else{
  
      online =[[FirstPage alloc] initWithNibName:nil bundle:nil];
  }
  
  //adding all controllers of tab bar to array
  [muteArray addObjectsFromArray:_navigationCotroller.viewControllers];
  online.tabBarControllers = [muteArray copy];
  //replacing object of login controller to after login controller
  [muteArray replaceObjectAtIndex:1 withObject:online];
  
  
  [online release];
  
  //setting new controllers to tab bar
  [_navigationCotroller setViewControllers:muteArray animated:YES];
  
  [muteArray release];
  </code></pre>
  
  <p>Then in FirstPage controller i do some change and press OK. Now i need to change controllers again, doing this:</p>
  
  <pre><code>NSLog(@"Before change Tab Bar cotrollers = %@",self.tabBarController.viewControllers);
  
  [self.tabBarController setViewControllers:_tabBarControllers animated:YES];
  
  NSLog(@"After change Tab Bar cotrollers = %@",self.tabBarController.viewControllers);
  
  [self.tabBarController.tabBarController setSelectedIndex:1];
  </code></pre>
  
  <p>_tabBarControllers is array of controllers which i saved when app started.</p>
  
  <p>This code change controllers, but when i want to open changed controller with setSelectedIndex it don't work. </p>
  
  <p>Any ideas ?</p>
  
  <p>And print this:</p>
  
  <p>Before change Tab Bar cotrollers = NULL
  After change Tab Bar cotrollers = NULL</p>