iOS 11 双击图像会关闭 UIImagePickerController 和演示者 View Controller

标签 ios swift ios11

我们有一个用 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/

相关文章:

ios - 适用于 IOS 11 及更高版本的 Ionic 1 应用程序中的内容重叠

ios - 快速多重通知

ios - 从 HealthKit 中提取时的额外字符

uinavigationcontroller - 应用商店导航栏功能

ios - 使用 Vision 框架跟踪本地视频中的人脸

ios - 自定义 UIView 上的 Google map GMSMapView

javascript - 使用 PhoneGap 下载 PDF 以供离线查看?

iPhone游戏加载/保存/配置关卡

ios - UITextview 显示文本阿拉伯语但数字英语

ios - 根据plist文件快速更改标签文本背景颜色