title: iOS5 SplitViewController leaves BarButton visible while in landscape view on app startup
body: <p>I have a UISplitViewController with a UIViewController as master and a UINavigationController as my details controller (which contains an actual DetailsController as it's rootController).</p>
  
  <p>In iOS5, at app startup (holding the device in landscape view), I add the splitViewController's view to my window but then I present a loginController on top of the splitViewController like this:</p>
  
  <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  {
      self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
      // Override point for customization after application launch.
  
      KRMasterViewController *masterViewController = [[[KRMasterViewController alloc] initWithNibName:@"KRMasterViewController" bundle:nil] autorelease];
      UINavigationController *masterNavigationController = [[[UINavigationController alloc] initWithRootViewController:masterViewController] autorelease];
  
      KRDetailViewController *detailViewController = [[[KRDetailViewController alloc] initWithNibName:@"KRDetailViewController" bundle:nil] autorelease];
      UINavigationController *detailNavigationController = [[[UINavigationController alloc] initWithRootViewController:detailViewController] autorelease];
  
      self.splitViewController = [[[UISplitViewController alloc] init] autorelease];
      self.splitViewController.delegate = detailViewController;
      self.splitViewController.viewControllers = [NSArray arrayWithObjects:masterNavigationController, detailNavigationController, nil];
      [self.window addSubview:self.splitViewController.view];
  
      LoginController *controller=[[LoginController alloc]
                                          initWithNibName:@"LoginController" bundle:nil];
      [self.splitViewController presentModalViewController:controller animated:false];
  
      [self.window makeKeyAndVisible];
      return YES;
  }
  </code></pre>
  
  <p>As you can see the detailsController is my splitViewController's delegate. The problem is in iOS4, before the loginController gets displayed, the delegate method:</p>
  
  <pre><code>- (void)splitViewController:(UISplitViewController *)splitController willHideViewController:(UIViewController *)viewController withBarButtonItem:(UIBarButtonItem *)barButtonItem 
         forPopoverController:(UIPopoverController *)popoverController
  </code></pre>
  
  <p>is called then when I dismiss the loginController the delegate method:</p>
  
  <pre><code>- (void)splitViewController:(UISplitViewController *)splitController willShowViewController:(UIViewController *)viewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem
  </code></pre>
  
  <p>gets called. I guess iOS realizes really late that I'm in landscape but figures out before I got to the detailController so everything was cool. In iOS 5, the second method does not get called by the time I get to the splitViewController. This means I'm left with the barButtonItem visible in landscape view. Funny enough, if I rotate to portrait then back to landscape, the methods gets called properly from then on. Anyone ever experienced this before? Any solutions?</p>