ios - iPad:横向呈现 UIImagePickerController 会在关闭时旋转我的其他 View Controller

标签 ios objective-c ipad uiimagepickercontroller uimodalpresentationstyle

我在 iPad 上使用 UIImagePickerControllerSourceTypeCamera 展示一个 UIImagePickerController。我知道其他 UIImagePickerControllerSourceType 选项需要在 UIPopoverController 中显示,但我怀疑相机应该是。

话虽这么说,但我正在从显示为 formSheet 的模态视图 Controller 中显示相机。有时,当我显示选择器时,它会向下移动几个像素,就像状态栏将它向下推一样:

enter image description here

接下来,当我关闭选择器时,它已将我的 formSheet 模态旋转为纵向模式,但底层的 UISplitViewController 仍处于横向:

enter image description here

这里发生了什么?从模态表单呈现 UIImagePickerController 时,我做错了什么吗?

最佳答案

我发现了问题所在。我的 UINavigationController 子类中有以下内容:

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

删除它解决了问题!

关于ios - iPad:横向呈现 UIImagePickerController 会在关闭时旋转我的其他 View Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14309961/

相关文章:

javascript - @import 的 CSS 条件使用

uisplitviewcontroller - 无法使 UIPopover 以编程方式出现

ios - 裁剪和缩放 MTLTexture

objective-c - 在 UITextView 中显示图像

ios - Alamofire - request.cancel() 也正在取消来自该服务器的所有其他请求?

ios - iPad 屏幕尺寸返回错误值

objective-c - 不兼容的 block 指针类型将 'void (^)(bool)' 发送到类型 'void(^)()' 的参数

objective-c - 进入后台时加载另一个应用程序

ios - 循环导航问题

ios - 如何使用自动布局以编程方式在 UIView 中添加 UIbutton