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

Total Post:52

Points:366
Posted on    June-04-2013 2:06 AM

 iPhone iPhone 
Ratings:


 1 Reply(s)
 3954  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!



AVADHESH PATEL

Total Post:604

Points:4228
Posted on    June-05-2013 8:36 AM

Hi Hugh,

you can do this with Subclassing UIImagePickerController

 @interface UAImagePickerController : UIImagePickerController {
}
@end

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

It may be helpful for you. 

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

Follow MindStick