iOS 11 double tap on image dismisses UIImagePickerController and presenter view controller

Viewed 1172

We have a photo picker made with UIImagePickerController.

When making double tap (instead of one tap) the photo from gallery.

  • On iOS 10: UIImagePickerController is dismissed
  • On iOS 11: UIImagePickerController is dismissed and presenting view controller is dismissed as well :0

Is it iOS 11 bug or we have to adjust something?


Our code:

  let vc = UIImagePickerController()
  vc.delegate = self
  vc.modalPresentationStyle = .overFullScreen
  vc.allowsEditing = false
  rootVC.present(vc, animated: true) // `rootVC` also presented modally.
2 Answers

Instead of self.dismiss(), use picker.dismiss()

func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any])
{
    //self.dismiss(animated: true, completion: nil)
    picker.dismiss(animated: true, completion: nil)
}

This will only dismiss your picker view and not the view controller.

Related