title: Alternative to private -[UIDevice setOrientation:] for forcing camera overlay into portrait mode
body: <p>I am making a camera app for iPad. I want the camera app to work only in portrait mode. I had to put in a rotation observation, and force the device to use portrait mode like this: </p>
  
  <p><a href="https://stackoverflow.com/questions/2083672/uiimagepickercontroller-in-landscape">UIImagePickerController in Landscape</a></p>
  
  <p>I think this is private API; some of the users on the post suggested that it is.</p>
  
  <p>If so, what other work around can I use to force the overlay to stay in portrait mode only? If I don't add this code it rotates to both portrait and landscape mode.</p>
  
  <pre><code>    //Is this private?
      @interface UIDevice ()
      -(void)setOrientation:(UIDeviceOrientation)orientation;
      @end
  
      -(IBAction)InitiateCamera
      {
  
      overlayview = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 768, 1024)];
      ...
      ...
  
      //monitor device rotation
          [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
              [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didRotate:) name:UIDeviceOrientationDidChangeNotification object:nil];
  
  
  
  
          //launch camera
          [self presentViewController:picpicker animated:YES completion:nil];
  
  
      }
  
  
  
      - (void) didRotate:(NSNotification *)notification
      {
  
  
  //IS THIS PRIVATE?
          //Maintain the camera in portrait orientation
          [[UIDevice currentDevice] setOrientation:UIInterfaceOrientationPortrait];
  
      }
  
      - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
      {
          return UIInterfaceOrientationIsPortrait(interfaceOrientation);
      }
  
      -(NSUInteger)supportedInterfaceOrientations
      {
  
          return UIInterfaceOrientationMaskPortrait;
      }
  
      - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
      {
          return UIInterfaceOrientationPortrait;
      }
  </code></pre>