在横向中打开UIImagePickerController

时间:2017-11-24 05:04:21

标签: ios uiimagepickercontroller swift4

我正在尝试以横向模式为iPhone呈现UIImagePickerController,因为我的应用程序仅支持横向模式。这适用于iOS 11.但每当我在iOS 10.3.3中运行我的应用程序时,它会同时崩溃并出现错误:

*** Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [PUUIAlbumListViewController shouldAutorotate] is returning YES' * First throw call stack:**

1 个答案:

答案 0 :(得分:0)

创建UIImagePickerController的扩展名,如下所示

extension UIImagePickerController
    {
        override open var shouldAutorotate: Bool {
                return true
        }
        override open var supportedInterfaceOrientations : UIInterfaceOrientationMask {
                return .all
        }
   }

希望能帮到你