title: Is it possible to insert a subview while being on the same tab bar index?
body: <p>To give some context, I have logic that programmatically decides what view controller to insert into the navigation controller. For example: </p>
  
  <pre><code>If(true){
  
  MyViewController * MyObject = [[MyViewController alloc]init];
  
  myNavigationController = [[UINavigationController alloc]initWithViewController:MyObject];
  
  else {
  MyOtherViewController * MyOtherObject = [[MyViewController alloc]init];
  
  myNavigationController = [[UINavigationController alloc]initWithViewController:MyOtherObject];
  }
  
    self.tabBarController.viewControllers=[NSArray arrayWithObjects:myNavigationController,nil];
  </code></pre>
  
  <p>Hopefully that illustrates my point of how I insert views inside of navigation controller. Now onto my problem:</p>
  
  <p>I have an action listener with a button inside of "MyViewController" that essentially replaces the navigation/tab bar index when the user clicks the button. Is it possible to update a navigation/tab bar index with just a button? </p>
  
  <pre><code> MyViewController.m 
  
  
  - (IBAction)MyActionListener:(id)sender {
         MyOtherViewController *MyOtherObject = [[MyOtherViewController alloc] initWithNibName:@"MyOtherViewController" bundle:nil];
  
  
  
                  [self.view insertSubview:MyOtherViewController.view atIndex:2];
  }
  </code></pre>
  
  <p>When I do this, I get a crash <code>EXEC_BAD_ACCESS</code> I'm just wondering if my implementation/approach is wrong. I noticed this question: <a href="https://stackoverflow.com/questions/3998117/update-uitabbar-views">Update UITabBar Views?</a>
  However, doesn't seem to fit the results I am looking for. Hopefully I am clear. Thanks! </p>