Home > DeveloperSection > Forums > UIImagePickerController in portrait mode inside UIPopoverController when view is locked for landscape mode
Hugh Jackman
Hugh Jackman

Total Post:52

Posted on    June-04-2013 2:06 AM

 iPhone iPhone 

 1 Reply(s)
 4064  View(s)
Rate this:
Hi Mindstickians,

I am using the following code for opening camera inside pop up view controller in iPad. Everything is working fine except it always open in landscape mode. I want to 

open pop camera in landscape mode. Parent view is locked to landscape mode.
Please let me know is it possible to change the camera frame size to portrait mode.

UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.cameraDevice = UIImagePickerControllerCameraDeviceFront;
imagePicker.delegate = self;
UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
self.popOverController = popover;
popover.popoverContentSize = CGSizeMake(350, 500);
popover.delegate = self;
[self.popOverController presentPopoverFromRect:CGRectMake(100, 100, 350,500) inView:self permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES];

Any help would be amazing thank you!


Total Post:604

Posted on    June-05-2013 8:36 AM

Hi Hugh,

you can do this with Subclassing UIImagePickerController

 @interface UAImagePickerController : UIImagePickerController {

@implementation UAImagePickerController
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
    return UIDeviceOrientationIsPortrait(toInterfaceOrientation);

It may be helpful for you. 

Don't want to miss updates? Please click the below button!

Follow MindStick