简体   繁体   English

相机解雇后,iOS方向适应未经批准的设备方向

[英]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. 我目前正在编写一个iOS应用,其中将可接受的设备方向设置为“横向右”和“横向左”,并且在我所有的视图控制器中,我仅在supportedInterfaceOrientations方法中返回这两个。

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). 但是,如果用户使用应用程序内摄像头功能(通过以全屏模式呈现的UIImagePickerController来实现)并将设备旋转为纵向以拍摄照片,则摄像头将旋转至纵向模式(可以),并且用户单击“使用照片”,则关闭模态视图后,启动相机的视图现在以某种方式处于纵向模式(这不太好)。

After the camera view has been dismissed, the view controller from which it was launched has UIDeviceOrientationIsPortrait set to true. 取消摄影机视图后,从其启动视图的视图控制器将UIDeviceOrientationIsPortrait设置为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. 我目前正在编写一个iOS应用,其中将可接受的设备方向设置为“横向右”和“横向左”,并且在我所有的视图控制器中,我仅在supportedInterfaceOrientations方法中返回这两个。

In iOS 6 and later, your app supports the interface orientations defined in your app's Info.plist file 在iOS 6和更高版本中,您的应用程序支持在应用程序的Info.plist文件中定义的界面方向

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 ? 另外,如果这不起作用,请尝试在启动UIImagePickerViewControllerviewWillAppear方法中设置supportedInterfaceOrientations值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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