我的目标是从第一个视图控制器中的照片库中选择一张图片,并在第二个视图控制器中显示它
func photoLibrary() {
if UIImagePickerController.isSourceTypeAvailable(.photoLibrary){
let myPickerController = UIImagePickerController()
myPickerController.delegate = self;
myPickerController.sourceType = .photoLibrary
self.present(myPickerController, animated: true, completion: nil)
}
}
这是我尝试将选择的图片保存到本地图像子视图中的地方,但出现错误:
发现]在发现扩展时遇到错误:错误Domain = PlugInKit代码= 13“查询已取消” UserInfo = {NSLocalizedDescription =查询已取消}
//
var imageView = UIImageView()
let cvc = SecondViewController(collectionViewLayout: UICollectionViewFlowLayout())
func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {
if let pickedImage = info[UIImagePickerControllerOriginalImage] as? UIImage {
imageView.contentMode = .scaleAspectFit
imageView.image = pickedImage
// I get the error here
// I try to pass imageView to the other view controller's property 'imageView.'
// It never gets to this point because of the error
cvc.imageView = imageView
}
dismiss(animated: true, completion: nil)
}