})
}else{
print("读取相册错误")
}
}
//还原图片
@IBAction func resetImage(sender: UIButton) {
self.imageView.image = self.chooseImage
}
//代理
//选择图片成功后代理
func imagePickerController(picker: UIImagePickerController,
didFinishPickingMediaWithInfo info: [String : AnyObject]) {
//查看info对象
print(info)
//获取选择的原图
let image = info[UIImagePickerControllerOriginalImage] as! UIImage
self.imageView.image = image
self.chooseImage = image
//图片控制器退出
picker.dismissViewControllerAnimated(true, completion: {
() -> Void in
})
}
}
storyboard里的是如何设置的
然后大家试试效果吧 在文章顶部的链接里是有效果图的,建议那边去看看,我就不截图了