Note that there are some explanatory texts on larger screens.

plurals
  1. POUIImagePickerController in landscape orientation
    text
    copied!<p>I want the UIImagePickerController to start(and stay) in Landscape orientation code. I tried the solution as described here (<a href="https://stackoverflow.com/questions/2083672/uiimagepickercontroller-in-landscape">UIImagePickerController in Landscape</a>)</p> <pre><code>//Initialize picker UIImagePickerController * picker = [[UIImagePickerController alloc] init]; picker.delegate = self; //set Device to Landscape. This will give you a warning. I ignored it. //warning: 'UIDevice' may not respond to '-setOrientation:' [[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight]; //Set Notifications so that when user rotates phone, the orientation is reset to landscape. [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; //Refer to the method didRotate: [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didRotate:) name:@"UIDeviceOrientationDidChangeNotification" object:nil]; //Set the picker source as the camera picker.sourceType = UIImagePickerControllerSourceTypeCamera; //Bring in the picker view [self presentModalViewController:picker animated:YES]; </code></pre> <p>The method didRotate:</p> <pre><code>- (void) didRotate:(NSNotification *)notification { //Maintain the camera in Landscape orientation [[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight]; } </code></pre> <p>But the solution does not work for iOS 4.0. The app doesnot respond when camera is launched in iOS 4.0. Can anyone suggest a work around to this? </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload