Search code examples
iosipaduiimagepickercontrolleruipopovercontroller

Landscape only iPad app displays UIImagePicker in portrait orientation


I have an iPad app that only supports landscape orientations, however when I try to display a UIImagePickerController inside a UIPopoverController it always appears in portrait mode. i.e. rotated 90 degrees from the rest of the UI. Does anyone know how I can make this appear in the same orientation as the ViewController I'm presenting it in?

I'm displaying the imagePicker like this:

self.picker = [[FFSImagePicker alloc] init];

picker.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeImage];
picker.delegate = self;
picker.toolbarHidden = YES;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.allowsEditing = NO;
picker.showsCameraControls = YES;

UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:picker];
self.photoPickerPopover = popover;

[self.photoPickerPopover presentPopoverFromRect:photoButton.bounds inView:photoButton permittedArrowDirections:UIPopoverArrowDirectionRight animated:YES];

FFSImagePicker is just a subclass of UIImagePickerController where I tried to make sure the supported orientations were only landscape, but that had no effect.

Thanks for any help...


Solution

  • OK, I solved this, the issue was that I was presenting the UIImagePickerController in a UIPopover which Apple says not to do when the source type is the camera, instead present it full screen just like you would any other view controller.

    Hope this helps someone else too...