【问题标题】:Swift PLUICameraViewController shouldAutorotate] is returning YES'Swift PLUICameraViewController shouldAutorotate] 返回 YES'
【发布时间】:2014-12-16 22:35:06
【问题描述】:

我的应用程序只有横向,我用这段代码拍照

@IBAction func shootPhoto(sender: UIBarButtonItem){

    if UIImagePickerController.availableCaptureModesForCameraDevice(.Rear) != nil {
        picker.allowsEditing = false
        picker.sourceType = UIImagePickerControllerSourceType.Camera
        picker.cameraCaptureMode = .Photo
        presentViewController(picker, animated: true, completion: nil)
    } else {
        noCamera()
    }
}

但是当我按下按钮时,我得到了这个错误

'UIApplicationInvalidInterfaceOrientation',原因:'支持的方向与应用程序没有共同的方向,并且[PLUICameraViewController shouldAutorotate]返回YES'

【问题讨论】:

    标签: swift ios8


    【解决方案1】:

    根据苹果的文档UIImagePickerController

    重要

    UIImagePickerController 类仅支持纵向模式。这 class 旨在按原样使用,不支持子类化。 此类的视图层次结构是私有的,不得修改, 除了一个例外。您可以将自定义视图分配给 cameraOverlayView 属性并使用该视图来呈现额外的 信息或管理相机界面之间的交互 和你的代码。

    您必须在部署信息下的目标常规设置中检查纵向设备方向。

    【讨论】:

      猜你喜欢
      • 2012-10-28
      • 2012-10-19
      • 2012-09-14
      • 2014-11-19
      • 1970-01-01
      • 1970-01-01
      • 2013-01-05
      • 2011-11-16
      • 2011-05-01
      相关资源
      最近更新 更多