之后,更新了pList.I可以访问照片库.但是,Picker图像没有加载到我的imageVIEw.
我的代码:
注意:
下面的代码用于Xcode 7而不是Xcode 8?
import UIKit class VIEwController: UIVIEwController,UIImagePickerControllerDelegate,UINavigationControllerDelegate { let imagePicker = UIImagePickerController() @IBOutlet weak var imageVIEw: UIImageVIEw! overrIDe func vIEwDIDLoad() { super.vIEwDIDLoad() // Do any additional setup after loading the vIEw,typically from a nib. imagePicker.delegate = self } @IBAction func library(_ sender: UIbutton) { if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.photolibrary) { imagePicker.delegate = self imagePicker.sourceType = UIImagePickerControllerSourceType.photolibrary; imagePicker.allowsEditing = true self.present(imagePicker,animated: true,completion: nil) } }
代码更新:来自rmaddy回答:
func imagePickerController(_ picker: UIImagePickerController,dIDFinishPickingMediawithInfo info: [String : Any]) { if let image = info[UIImagePickerControllerOriginalimage] as? UIImage { imageVIEw.image = image } picker.dismiss(animated: true,completion: nil); }
提前致谢….
解决方法 在Swift 3中,您需要使用正确的委托方法:func imagePickerController(_ picker: UIImagePickerController,dIDFinishPickingMediawithInfo info: [String : Any]) { if let image = info[UIImagePickerControllerOriginalimage] as? UIImage { imageVIEw.image = image } picker.dismiss(animated: true,completion: nil);}总结
以上是内存溢出为你收集整理的UIImagePickerController didFinishPickingImage没有在Swift 3中调用全部内容,希望文章能够帮你解决UIImagePickerController didFinishPickingImage没有在Swift 3中调用所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)