UIImagePickerController in portrait mode inside UIPopoverController when view is locked for landscape mode

Total Post:51

Points:359

iPhone 
 6152  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. 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. 

      Modified On Mar-30-2018 01:34:08 AM

Answer

Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.