在使用图像选择器选择图像时,如果我在关闭图像选择器后多次选择(双击图像),我的 View Controller 也会被关闭
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
let selectedImage = info[UIImagePickerControllerOriginalImage] as! UIImage
userImage.image = selectedImage
dismiss(animated: true, completion: nil)
}
如何限制代码在双击图像时不关闭我的 View Controller 。只需要关闭图像选择器 Controller
最佳答案
这里的问题是 dismiss() 方法正在调用 viewController 对象来关闭。您必须指定要解雇哪一个。使用:picker.dismiss(animated: true, completion: nil)
关于ios - 在使用图像选择器选择图像时,如果我点击多次,我的 View Controller 也会消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51916280/