title: iPhone Interface Orientation on iOS8
body: <p>I have been trying to do this for 2 weeks, and just found out the reason it's not working:</p>
  <blockquote>
  <p><strong>Deprecated APIs</strong></p>
  <p>The following APIs are deprecated:</p>
  <p>The UIViewController methods and properties for interface orientation. Traits and size classes replace them, as described in <a href="https://developer.apple.com/library/prerelease/ios/releasenotes/General/WhatsNewIniOS/Articles/iOS8.html#//apple_ref/doc/uid/TP40014205-SW30" rel="nofollow noreferrer">Unified Storyboards for Universal Apps</a>.</p>
  <p><a href="https://developer.apple.com/library/prerelease/ios/releasenotes/General/WhatsNewIniOS/Articles/iOS8.html" rel="nofollow noreferrer">From what's new in iOS 8</a></p>
  </blockquote>
  <p>What I need is: a <code>FirstViewController</code>, which is the <code>rootViewController</code> to my <code>navigationController</code>. The <code>FristViewController</code> should be <em>only</em> available in Portrait mode (not ever ever ever displayed in Landscape).</p>
  <p>Then there are a few intermediate ViewControllers in the navigation stack (which support both orientations), until I reach a <code>LastViewController</code>, which should be available <em>only</em> in LandscapeRight mode (and never ever ever in portrait, or another mode).</p>
  <p>I have been trying with the following <code>CustomNavigationController</code>, but apparently things changed in iOS8, and I can't get it to work:</p>
  <pre><code>- (BOOL)shouldAutorotate { // Available in iOS 6.0 and later
      return YES; //  // May use topViewController's, but in this app it always returns YES
  }
  
  - (NSUInteger)supportedInterfaceOrientations { // Available in iOS 6.0 and later
      if (self.topViewController != nil)
          return [self.topViewController supportedInterfaceOrientations];
      else
          return [super supportedInterfaceOrientations];
  }
  
  - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { // Available in iOS 6.0 and later
      if (self.topViewController != nil)
          return [self.topViewController preferredInterfaceOrientationForPresentation];
      else
          return [super preferredInterfaceOrientationForPresentation];
  }
  </code></pre>
  <p>Thanks!</p>