extension ViewController: UIImagePickerControllerDelegate, UINavigationControllerDelegate {
@IBAction func btnClick(sender: UIBarButtonItem) {
let vc = UIImagePickerController()
vc.sourceType = UIImagePickerControllerSourceType.PhotoLibrary
vc.delegate = self
self.presentViewController(vc, animated: true, completion: nil)
}
func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {
let image = info[UIImagePickerControllerOriginalImage] as! UIImage
iamgeV.image = image
picker.dismissViewControllerAnimated(true, completion: nil)
}
}
网友评论