title: ViewController orientation not coherent with status bar
body: <p>My app has this main structure: UITabBarController, where each tab hosts a UINavigationController that pushes views according to user interaction. Almost all the app is portrait orientation only, except a few specific sections.</p>
  
  <p>The behavior I want is to have landscape orientation when I <code>push</code> one of the sections (let's say a map). In that map, the user can go back to portrait orientation. When he goes back in the main menu, he should go back to portrait orientation (landscape should not be allowed here). I don't mind if he is temporarily in landscape.</p>
  
  <p>Here's some code from my UITabBarController subclass:</p>
  
  <pre><code>- (BOOL)shouldAutorotate
  {
      return [self.selectedViewController shouldAutorotate];
  }
  
  - (NSUInteger)supportedInterfaceOrientations
  {
      return [self.selectedViewController supportedInterfaceOrientations];
  }
  
  - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
  {
      return [self.selectedViewController preferredInterfaceOrientationForPresentation];
  }
  </code></pre>
  
  <p>I use the same code in my UINavigationController, and in the specific menu, I have this:</p>
  
  <pre><code>- (NSUInteger)supportedInterfaceOrientations
  {
      return UIInterfaceOrientationMaskAll;
  }
  
  - (BOOL)shouldAutorotate
  {
      if (!UIInterfaceOrientationIsPortrait([[UIDevice currentDevice] orientation]))
          return NO;
  
      return YES;
  }
  
  - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
  {
      return UIInterfaceOrientationPortrait;
  }
  </code></pre>
  
  <p>The behavior works almost all the time. When the orientation of the menu is landscape and the user rotates his device, he goes back to portrait, but can't go back to landscape.</p>
  
  <p><strong>My issue is: once in a while, the status bar will rotate, but not the view controller.</strong> <em>(see picture)</em> Each time, <code>shouldAutorotate</code> is called and returns the correct value (ie. it returns YES but does not autorotate). </p>
  
  <p><em>I know this is stretching the SDK</em>, but I'd love to make this work all the time. Any hints?</p>
  
  <p><img src="https://i.stack.imgur.com/XqxS6.png" alt="enter image description here"></p>