gpt4 book ai didi

Swift PLUICameraViewController shouldAutorotate] 返回 YES'

转载 作者:行者123 更新时间:2023-11-28 05:32:09 30 4
gpt4 key购买 nike

我的应用只有横向模式,使用这段代码我可以拍照

@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', reason: 'Supported orientations has no common orientation with the application, and [PLUICameraViewController shouldAutorotate] is returning YES'

最佳答案

根据 Apple 文档 UIImagePickerController :

IMPORTANT

The UIImagePickerController class supports portrait mode only. This class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified, with one exception. You can assign a custom view to the cameraOverlayView property and use that view to present additional information or manage the interactions between the camera interface and your code.

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

enter image description here

关于Swift PLUICameraViewController shouldAutorotate] 返回 YES',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27515241/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com