title: How do I restrict orientation per view controller in iOS7 in a navigation controller hierarchy
body: <p>My app is a UITabBarController --> UINavigationController --> UITableViewController --> UIViewController.</p>
  
  <p>I want to do 2 things:</p>
  
  <ol>
  <li><p>Prevent my tableview from rotating, I want it to always stay portrait.</p></li>
  <li><p>FORCE &amp; Allow my UIViewcontroller to rotate landscapeleft.</p></li>
  </ol>
  
  <p>What I know:</p>
  
  <ol>
  <li><p>I understand that the viewcontroller at the top of the hierarchy controls rotation.  This would be my UITabBarController?  Or rather its only viewcontroller which would be at objectIndex:0?</p></li>
  <li><p>My project settings allow for Portrait, LL and LR rotations.  Im thinking this is the pattern I need to follow in order to solve this is allow ALL at the top level to rotate and then control each vc individually, correct?</p></li>
  </ol>
  
  <p>This is what I have found so far in SO.</p>
  
  <p>So for my top hierarchy, i set the project settings to allow rotation to Portrait, LL and LR.</p>
  
  <p>and then in my tableviewcontroller which i dont want to rotate:</p>
  
  <pre><code>-(BOOL)shouldAutorotate{
      return NO;
  }
  
  -(NSUInteger)supportedInterfaceOrientations{
      return UIInterfaceOrientationMaskPortrait;
  }
  </code></pre>
  
  <p>and finally in my uiviewcontroller which I want to rotate:</p>
  
  <pre><code>-(NSUInteger)supportedInterfaceOrientations{
      return UIInterfaceOrientationMaskAllButUpsideDown;
  }
  
  -(BOOL)shouldAutorotate{
      return YES;
  }
  </code></pre>
  
  <p>However this does not work.  I can rotate both in any direction.  I also dont know how to force rotation LL when I get to my uivc which is called from a modal segue from my tablevc.</p>
  
  <p>Any help understanding this mess would be greatly appreciated :)</p>