Search code examples
iosobjective-cipaduiimagepickercontrolleruimodalpresentationstyle

iPad: Presenting UIImagePickerController in landscape rotates my other view controllers on dismiss


I am presenting a UIImagePickerController on iPad with UIImagePickerControllerSourceTypeCamera. I know that the other UIImagePickerControllerSourceType options need to be presented in a UIPopoverController, but I doubt the camera should be.

That being said, I am presenting the camera from a modal view controller that is presented as a formSheet. Sometimes when I present the picker, it is shifted down a few pixels, like the status bar pushed it down:

enter image description here

Next, when I dismiss the picker, it has rotated my formSheet modal to portrait mode, but the underlying UISplitViewController is still in landscape:

enter image description here

What is happening here? Am I doing something wrong when presenting a UIImagePickerController from a modal form sheet?


Solution

  • I found out what the issue was. I had the following in my UINavigationController subclass:

    // Tell the system which initial orientation we want to have
    - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
        return UIInterfaceOrientationPortrait;
    }
    

    Removing that fixed the issue!