title: UISplitView button missing after detail replace segue
body: <p>I have a master detail iPad interface set up with storyboard to provide a replace segue on the detail view controller. This works fine to replace the detail controller, however the bar button to display the master controller is missing in certain situations.</p>
  
  <p>If I do the segue while in portrait, the bar button is missing because the <code>willHideViewController:</code> delegate method is never called. I am setting the delegate to the new detail controller when <code>prepareForSegue:</code> is called from the master.</p>
  
  <p>When the button is missing, I can rotate the iPad to landscape then back to portrait and the button will then appear.</p>
  
  <p>In <code>prepareForSegue:</code></p>
  
  <pre><code>UINavigationController *nav = [segue destinationViewController];
      UIViewController *destinationViewController = nav.topViewController;
      if ([destinationViewController conformsToProtocol:@protocol(UISplitViewControllerDelegate)]) {
          self.splitViewController.delegate = destinationViewController;
      }
      else {
          self.splitViewController.delegate = nil;
      }
  </code></pre>
  
  <p>In the detail controllers:</p>
  
  <pre><code>#pragma mark - Split view
  
  - (void)splitViewController:(UISplitViewController *)splitController willHideViewController:(UIViewController *)viewController withBarButtonItem:(UIBarButtonItem *)barButtonItem forPopoverController:(UIPopoverController *)popoverController
  {
      barButtonItem.title = NSLocalizedString(@"MasterButton", @"Master");
      [self.navigationItem setLeftBarButtonItem:barButtonItem animated:YES];
      self.masterPopoverController = popoverController;
  }
  
  - (void)splitViewController:(UISplitViewController *)splitController willShowViewController:(UIViewController *)viewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem
  {
      // Called when the view is shown again in the split view, invalidating the button and    popover controller.
      [self.navigationItem setLeftBarButtonItem:nil animated:YES];
      self.masterPopoverController = nil;
  }
  </code></pre>