iOS 方向在相机关闭后适应未经批准的设备方向

标签 ios objective-c device screen-orientation screen-rotation

我目前正在编写一个 iOS 应用程序,其中可接受的设备方向设置为横向右和横向左,并且在我所有的 View Controller 中,我在 supportInterfaceOrientations 方法中只返回这两个。

但是,如果用户使用应用内相机功能(通过 UIImagePickerController 以全屏模式呈现)并将设备旋转到纵向拍摄照片,相机将旋转到纵向模式(这很好),并且如果用户单击“使用照片”,当模态视图被关闭时,启动相机的 View 现在以某种方式处于纵向模式(这不好)。

关闭相机 View 后,启动它的 View Controller 将 UIDeviceOrientationIsPortrait 设置为 true。我想知道它是如何以这个方向结束的,以及在拍摄照片时如何确保呈现 View Controller 保持横向。任何帮助是极大的赞赏!

最佳答案

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 6 及更高版本中,您的应用程序支持在应用程序的 Info.plist 文件中定义的界面方向

你试过在这里设置吗?然后看看问题是否仍然存在。

此外,如果这不起作用,请尝试设置 supportedInterfaceOrientations viewWillAppear 中的值ViewController 的方法推出UIImagePicker ?

关于iOS 方向在相机关闭后适应未经批准的设备方向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20498693/

相关文章:

ios - 向使用安全区域的场景添加边距

objective-c - 将 Int64 转换为 UUID

objective-c - 尝试将面子书登录按钮移植到 swift

ios - 将标点符号从半角转换为全角

iOS USB HID编程

iphone - 如何将我的设备恢复到 ios 5.0.1?

ios - 在 UITableViewCell 上向右滑动

ios - this.setState 不是一个函数并且未定义,即使它的上下文设置正确

java - 在java中写在linux chardevice上

wmi - PNPDeviceID 格式