Reputation: 879
While selecting image using image picker if i select multiple times (double tap on image) after dismissing the image picker my view controller also getting dismissed
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
let selectedImage = info[UIImagePickerControllerOriginalImage] as! UIImage
userImage.image = selectedImage
dismiss(animated: true, completion: nil)
}
how to restrict the code not to dismiss my view controller while double tapping the image. Need to dismiss the image picker controller only
Upvotes: 1
Views: 748
Reputation: 191
The problem here is that dismiss() method is calling the viewController object to dismiss. you have to specify which one to dismiss. use: picker.dismiss(animated: true, completion: nil)
Upvotes: 2