我们有一个用 UIImagePickerController
制作的照片选择器。
当双击点击(而不是一次点击)图库中的照片时。
- 在 iOS 10 上:
UIImagePickerController
被关闭 - 在 iOS 11 上:
UIImagePickerController
被取消,呈现 View Controller 也被取消:0
是 iOS 11 的错误还是我们必须调整一些东西?
我们的代码:
let vc = UIImagePickerController()
vc.delegate = self
vc.modalPresentationStyle = .overFullScreen
vc.allowsEditing = false
rootVC.present(vc, animated: true) // `rootVC` also presented modally.
最佳答案
使用 picker.dismiss() 而不是 self.dismiss()
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any])
{
//self.dismiss(animated: true, completion: nil)
picker.dismiss(animated: true, completion: nil)
}
这只会关闭您的选择器 View ,而不是 View Controller 。
关于iOS 11 双击图像会关闭 UIImagePickerController 和演示者 View Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47200759/