title: iOS 6 controlling autorotation of view controllers behind UIImagePickerController
body: <p>My iPad app has a <code>UIViewController</code> called <code>MainViewController</code> which presents a modal page sheet <code>UIViewController</code> called <code>ModalViewController</code>. <code>ModalViewController</code> then presents a <code>UIImagePickerController</code>.</p>
  
  <p>Here is <strong>MainViewController.m</strong>:</p>
  
  <pre><code>@implementation MainViewController {
  
  ...
  
  - (BOOL)shouldAutorotate
  {
      return YES;
  }
  
  - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
  {
      return UIInterfaceOrientationIsLandscape(toInterfaceOrientation);
  }
  
  - (NSUInteger)supportedInterfaceOrientations
  {
      return UIInterfaceOrientationMaskLandscape;
  }
  
  - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
  {
      return UIInterfaceOrientationLandscapeRight;
  }
  
  ...
  
  }
  </code></pre>
  
  <p>So it rotates to either of the landscape orientations, and when <code>ModalViewController</code> is presented it rotates that correctly also. </p>
  
  <p>However when the <code>UIImagePickerController</code> is presented, it allows rotation to landscape or portrait orientations, and this allows <code>MainViewController</code> and <code>ModalViewController</code> to rotate to un-desired orientations.</p>
  
  <p>How can I prevent <code>MainViewController</code> and <code>ModalViewController</code> from rotating when the <code>UIImagePickerController</code> is on the screen?</p>