title: How to manually set the device orientation when App Deployment Info portrait is locked?
body: <p>I dont want my app to be landscaped and always be porttrait.So i made my app <strong>Deployment Info</strong> to set portrait only. but when i need to display any image or videos in my app,i need landscape mode for better display.</p>
  
  <p>I can detect the device orientation change by</p>
  
  <pre><code>[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
  
  [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(orientationChanged:)
   name:UIDeviceOrientationDidChangeNotification
   object:[UIDevice currentDevice]];
  
  - (void) orientationChanged:(NSNotification *)note
  {
  UIDevice * device = note.object;
  switch(device.orientation)
  {
      case UIDeviceOrientationPortrait:
          /*  */
          break;
  
      case UIDeviceOrientationPortraitUpsideDown:
          /*  */
          break;
      case UIDeviceOrientationLandscapeLeft:
         /*  */
         break;
  
      case UIDeviceOrientationLandscapeRight:
         /*  */
         break;
      default:
          break;
  };
  }
  </code></pre>
  
  <p>But how do i manually change my device orientation even when App Deployment Info portrait is locked ?</p>
  
  <p>This <strong>doesnt worked</strong></p>
  
  <pre><code>NSNumber *value=[NSNumber numberWithInt: UIDeviceOrientationLandscapeLeft];
  [[UIDevice currentDevice] setValue:value forKey:@"orientation"]; 
  </code></pre>