gpt4 book ai didi

ios - UIImagePickerController 不保存图像到 UIImageView

转载 作者:行者123 更新时间:2023-11-29 02:11:51 24 4
gpt4 key购买 nike

所以我环顾四周并尝试了一些不同的东西,但我似乎仍然无法弄清楚为什么图像没有保存到 UIImageView。我已经检查并且 View Controller 符合所有必要的协议(protocol),并且我已将图像选择器委托(delegate)设置为 self 。这是处理所选图像的代码。其他一切正常,只是在选择 ImageView 后没有图像发送到 ImageView 。

 func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [NSObject : AnyObject]) {
recipeImage.image = info[UIImagePickerControllerOriginalImage] as? UIImage
picker.dismissViewControllerAnimated(true, completion: nil)
}

最佳答案

尝试先像这样关闭 imagePicker

 func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [NSObject : AnyObject]) 
{
picker.dismissViewControllerAnimated(true, completion: nil)
recipeImage.image = info[UIImagePickerControllerOriginalImage] as? UIImage

}

关于ios - UIImagePickerController 不保存图像到 UIImageView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29214165/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com