title: How to force view controller orientation in iOS 10?
body: <p>I have tried:</p>
  
  <p>--> Subclassing UINavigationController and overriding autorotate methods</p>
  
  <p>--> Overriding autorotate methods on MyViewController</p>
  
  <p>--> And both.</p>
  
  <p>Note: Also, I tried with autorotate sets NO and YES</p>
  
  <p>This is my code:</p>
  
  <p>NavigationControllerNoAutorotate:</p>
  
  <pre><code>@implementation NavigationControllerNoAutorotate
  
  - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
      return UIInterfaceOrientationPortrait;
  }
  
  - (BOOL)shouldAutorotate {
      return YES;
  }
  
  @end
  </code></pre>
  
  <p>MyViewController:</p>
  
  <pre><code>- (BOOL)shouldAutorotate {
      return NO;
  }
  
  - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
      return UIInterfaceOrientationMaskPortrait;
  }
  
  
  - (UIInterfaceOrientationMask)navigationControllerSupportedInterfaceOrientations:(UINavigationController *)navigationController {
      return UIInterfaceOrientationPortrait;
  }
  </code></pre>