iOS Orientation adapts to unapproved device orientation after Camera dismissed

198 views Asked by At

I am currently writing an iOS app in which have the acceptable device orientations set to Landscape Right and Landscape Left, and in all of my view controllers, I’m returning only those two in the supportedInterfaceOrientations method.

However, if the user uses the in-app camera functionality (which is implemented via UIImagePickerController presented modally in full screen) and rotates the device to Portrait orientation to take a picture, the camera rotates to portrait mode (which is fine), and if the user clicks "Use Photo", when the modal view is dismissed, the view from which the camera was launched is somehow now in portrait mode (which is not fine).

After the camera view has been dismissed, the view controller from which it was launched has UIDeviceOrientationIsPortrait set to true. I am wondering how it ended up in this orientation, and how when a picture is taken, I can ensure that the presenting view controller remains in a landscape orientation. Any help is greatly appreciated!

1

There are 1 answers

1
Ríomhaire On

I am currently writing an iOS app in which have the acceptable device orientations set to Landscape Right and Landscape Left, and in all of my view controllers, I’m returning only those two in the supportedInterfaceOrientations method.

In iOS 6 and later, your app supports the interface orientations defined in your app’s Info.plist file

Have you tried setting it here? Then see if the problem still occurs.

Also, if this doesn't work, try setting the supportedInterfaceOrientations values in the viewWillAppear method of the ViewController that launched UIImagePicker?