UIImagePickerController - 保存和加载图像?
关于这个主题的信息似乎很分散,但看起来相当混乱,所以我希望你不介意我问。
我有一个 UIImagePickerController 正在工作,让我可以拍照或从库中选择,然后设置我选择的 UIImageView 来显示拍摄/选择的图像。
但是,如何先保存图像,然后在重新打开应用程序时将其加载回来?另外,我将保存多个图像,因此需要唯一地标识它们。
任何帮助将不胜感激,谢谢。
There seems to be a scatter of info on this topic, but it seems rather a muddle, so I hoe you don't mind me asking.
I have a UIImagePickerController working, letting me either take a photo or pick on from the library and then set a UIImageView of my choice to show that image taken/selected.
However, how can I firstly save the image, then load it back in when the application is reopened? Also, I will be saving multiple images so they need to be uniquely identified.
Any help will be massively appreciated, thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道有什么方法可以再次从相册中获取照片。似乎没有办法再次检索它。我们做了一些事情来在内部保存图像。
我们要么将图像转换为 NSData 并将其保存在 CoreData 中,要么将其保存到沙箱中。
这是我们使用的一段代码,这是做几件事之一,我从屏幕截图中获取图像,尽管一旦你有了 UIImage,它是一样的。
上面使用的辅助函数
I don't know of a way to get the Photo from the Photo Album a Second time. There does not seem to be a way to retrieve it again. We do a few things to save the Image internally.
We either convert the Image to NSData and save it in CoreData, or we save it off to our sandbox.
here is a snip of code that we use, this is doing one of a few things, I'm getting the Image from a ScreenShot, though its the same once you have the UIImage.
Helper Functions used above