title: iOS UISplitViewController's Popover controller button disappear after pushing new view controller in portrait mode
body: <p>In my UISplitViewController application, I have </p>
  
  <ul>
  <li>RootViewController - view controller in the left pane.   </li>
  <li>DetailViewController - view controller in the right pane.</li>
  </ul>
  
  <p>When one item (which is in a UITableView) in RootViewController is tapped, new view controller will be set as the following shows:</p>
  
  <blockquote>
    <blockquote>
      <p><code>[detailViewController setViewControllers:[NSArray arrayWithObjects:newViewController, nil] animated:animated];</code></p>
      
      <p><code>//detailPane is my DetailViewController</code></p>
    </blockquote>
  </blockquote>
  
  <p>All works pretty well in landscape mode. However, I can't make the UISplitViewController work as what I want in portrait mode, that is, the RootViewController's popover button does not appear appropriately in my DetailViewController when I launch and use the application in portait mode.</p>
  
  <p>When I launch the app in portrait mode, the popover button appears appropriately.  But after tapping one item in the popover and a new view controller has been set on detailViewController, the button disappeared. I have to rotate the device to landscape and then back to portrait again to make the button appear again.</p>
  
  <p>I set my UISplitViewController's delegate in my application's AppDelegate as follows:</p>
  
  <blockquote>
    <blockquote>
      <p><code>self.splitViewController.delegate = self.detailViewController</code></p>
    </blockquote>
  </blockquote>
  
  <p>And here is my UISplitViewControllerDelegate implementation</p>
  
  <pre><code>- (void)splitViewController: (UISplitViewController*)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem*)barButtonItem  forPopoverController: (UIPopoverController*)pc {
      NSLog(@"Will hide view controller");
      barButtonItem.title = @"Menu";
      [self.navigationItem setLeftBarButtonItem:barButtonItem];
      self.popoverController = pc;
  }
  
  - (void)splitViewController: (UISplitViewController*)svc willShowViewController:(UIViewController *)aViewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem {
      NSLog(@"Will show view controller")
      NSMutableArray *items = [self.navigationItem.leftBarButtonItems mutableCopy];
      [items removeAllObjects];
      [self.navigationItem setLeftBarButtonItems:items animated:YES];
      [items release];
      self.popoverController = nil;   
  }
  </code></pre>
  
  <p>Any hint or help is greatly appreciated. 
  Thanks.</p>