使用UIImagePickerController,当我使用SourceType = .camera时,用户无法单击或返回

问题描述 投票:0回答:1

我正在使用uiimagepickercontroller,当用户选择.photolibrary模式从他的设备拍摄照片时,它可以正常工作,但是当他使用.camera时,他会捕获照片,然后该照片出现在左侧的retake下方,并在正确,但他无法单击它们或返回。

它在该屏幕上冻结,您必须重新启动应用程序。

代码:

@objc func openGallery (_ action: UIAlertAction) {

     let vc = UIImagePickerController ()
     vc.sourceType = .photoLibrary
     vc.allowsEditing = false
     vc.delegate = self
     present (vc, animated: true, completion: nil)

 }

@objc func doPhoto (_ action: UIAlertAction) {

  let vc = UIImagePickerController ()
    vc.sourceType = .camera
    vc.allowsEditing = false
    vc.delegate = self
    present (vc, animated: true, completion: nil)

}

func imagePickerControllerDidCancel (_ picker: UIImagePickerController) {
    dismiss (animated: true, completion: nil)
}

func imagePickerController (_ picker: UIImagePickerController, didFinishPickingMediaWithInfo
    info: [UIImagePickerController.InfoKey: Any]) {

    if (info [.originalImage] as? UIImage)! = nil {
        // HERE HAD MY CODE BUT I DELETED IT FOR PRIVACY IF REQUIRED I WOULD PUT IT
        dismiss (animated: true, completion: nil)

        }
    }
}
ios swift uiimagepickercontroller
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.