title: Modifying tab bar items in parent view controller
body: <p>Is it possible to modify tab bar items in the parent view controller during prepareForSegue? Basically, I'm trying to insert logic in the parent controller where one of 2 possible tab bar items may be removed upon segue.</p>
  
  <p>I've tried something along the lines of:</p>
  
  <pre><code>- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
  {
      if ([segue.identifier isEqualToString:@"identifierOfInterest"]) {
          UITabBarController *tabBarController = (UITabBarController *)segue.destinationViewController;
  
          // Attempt 1
          NSMutableArray *items = [[tabBarController.tabBar items] mutableCopy];
          [items removeObjectAtIndex:1];
          [tabBarController.tabBar setItems:items animated:YES];
  
          // Attempt 2
          NSMutableArray *items = [[tabBarController viewControllers] mutableCopy];
          [items removeObjectAtIndex:1];
          [tabBarController setViewControllers:items];
      }
  }
  </code></pre>
  
  <p>Unfortunately both messages crash the app with the following errors:</p>
  
  <p>Attempt 1:</p>
  
  <pre><code>Directly modifying a tab bar managed by a tab bar controller is not allowed.
  </code></pre>
  
  <p>Attempt 2:     </p>
  
  <pre><code>[UITabBarItem parentViewController]: unrecognized selector sent to instance
  </code></pre>
  
  <p>I'm using Xcode 4.2, iOS 5 with the UI Tab Bar Controller being a storyboard object, so there are no outlets to the tab bar or anything.</p>
  
  <p>Thanks in advance!</p>