title: UINavigationController Force Rotate
body: <p>My application is primarily portrait, however there is one view that REQUIRES a landscape orientation.</p>
  
  <p>My views are contained within a UINavigationController, which (apparently) is the cause of this issue.</p>
  
  <p>All UIViewControllers except one have this:</p>
  
  <pre><code>- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
  {
      // Return YES for supported orientations
      return (interfaceOrientation == UIInterfaceOrientationPortrait);
  }
  </code></pre>
  
  <p>The UIViewController that requires Landscape has this:</p>
  
  <pre><code>- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
  {
      // Return YES for supported orientations
      return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
  }
  </code></pre>
  
  <p>Now, what happens is when the user reaches the landscape UIViewController, it is shown in portrait. The user can then rotate their phone and it displays in landscape as I want it to (locking to landscape). The user then progresses onwards to a portrait UIViewController and the same happens: it start in landscape, then they rotate their phone and it becomes portrait again (and locks to portrait).</p>
  
  <p>It seems orientation locking is allowed between UIViewControllers, however auto-rotation / programmatically changing the orientation is somehow blocked.</p>
  
  <p><strong>How do I force the phone to update to the correct orientation?</strong></p>
  
  <p><em>There is a temporary solution: I can detect the orientation of the device and show a message asking them to rotate the device if it is not correct, however this is not optimal.</em></p>