UIIMAGEPICKERCONTROLLER IN PORTRAIT MODE INSIDE UIPOPOVERCONTROLLER WHEN VIEW IS LOCKED FOR LANDSCAPE MODE

Hugh Jackman

Total Post:52

Points:366
Posted by  Hugh Jackman
iPhone 
 5101  View(s)
Ratings:
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!

  1. AVADHESH PATEL

    Post:604

    Points:4228
    Re: UIImagePickerController in portrait mode inside UIPopoverController when view is locked for landscape mode

    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. 

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!