简体   繁体   中英

iOS Orientation adapts to unapproved device orientation after Camera dismissed

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!

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 ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM