title: Forcing UIInterfaceOrientation changes on iPhone
body: <p>I'm strugging with getting an iPhone application which requires just about every push or pop in the Nav Controller Stack to change orientation.</p>
  
  <p>Basically the first view is portrait, the second landscape the third portrait again (Yes I know this is less than ideal, but that's the design and I've got to implement it).</p>
  
  <p>I've been through various advice on here....<br>
  <a href="https://stackoverflow.com/questions/995723/how-do-i-detect-a-rotation-on-the-iphone-without-the-device-autorotating">How do I detect a rotation on the iPhone without the device autorotating?</a><br>
  <a href="https://stackoverflow.com/questions/1824682/force-portrait-orientation-on-pushing-new-view-to-uinavigationviewcontroller">Force portrait orientation on pushing new view to UINavigationViewController</a><br>
  <a href="https://stackoverflow.com/questions/181780/is-there-a-documented-way-to-set-the-iphone-orientation">Is there a documented way to set the iPhone orientation?</a><br>
  But without total success.</p>
  
  <p>Setting to link against 3.1.2 my reading of the linked articles above seems to indicate that if my portrait view pushes a view with 
  <code><pre>
  - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
      // Return YES for supported orientations
      return ((interfaceOrientation == UIInterfaceOrientationLandscapeRight) );
  }
  </pre></code>
  Then then that view should appear rotated to landscape. What happens is it appears in its "broken" portrait form, then rotates correctly as the device is turned.</p>
  
  <p>If I pop the controller back to my portrait view (which has an appropriate shouldAutoRotate...) then that remains in broken landscape view until the device is returned to portrait orientation.</p>
  
  <p>I've also tried removing all the shouldautorotate messages, and instead forcing rotation by transforming the view. This kind of works, and I've figured out that by moving the status bar (which is actually hidden in my application) <code>[UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationLandscapeRight;</code> the keyboard will appear with the correct orientation when desired.</p>
  
  <p>The problem with this approach is that the status bar transform is weird and ugly when you don't have a status bar - a shadow looms over the page with each change.</p>
  
  <p>So. What am I missing. </p>
  
  <p>1) Am I wrong in thinking that in 3.1.2 (or possibly earlier) shouldAutorotateToInterfaceOrientation should provide the desired orientation simply by pushing controllers ?</p>
  
  <p>2) Is there another way of getting keyboards to appear in the correct orientation.</p>
  
  <p>3) Are the undocumented API calls the way to go (please no!)</p>