I want the UIImagePickerController to start(and stay) in Landscape orientation code. I tried the solution as described here (http://stackoverflow.com/questions/2083672/uiimagepickercontroller-in-landscape)
//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];
The method didRotate:
- (void) didRotate:(NSNotification *)notification
{ //Maintain the camera in Landscape orientation [[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight];
}
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?