检索保存到照片库的 iPhone 照片
我正在将图像保存到照片库中,并希望动态检索它们以在将来启动我的应用程序时显示。 我使用 WriteToSavedPhotosAlbum 函数,如下所示,但没有获得任何信息来以编程方式访问保存的照片。
UIImageWriteToSavedPhotosAlbum(UIImage *image, id completionTarget, SEL completionSelector, void *contextInfo);
保存后,有没有办法检索文件名/ID 并稍后从照片库加载图像?
I am saving images to the photo library and would like to retrieve them dynamically to display in future launches of my app. I use the WriteToSavedPhotosAlbum function, as below, but do not get any info to access the saved photo programmatically.
UIImageWriteToSavedPhotosAlbum(UIImage *image, id completionTarget, SEL completionSelector, void *contextInfo);
Once saved, is there a way to retrieve the file name/id and load an image from the photo library at a later time?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你只需要为自己保存它们即可。
可能在您应用程序的文档或缓存文件夹中。
附带说明一下,当您说:“启动时显示”时,如果您的意思是替换 Default.png,那么这是行不通的。
启动图像必须是静态的并包含在您的应用程序包中。
如果没有,请忽略。
You just need to save them for yourself.
Possibly in your app's documents or cache folder.
As a side note, when you say: "display at launch", if you mean to replace the Default.png, that won't work.
The launch image must be static and included in your app bundle.
If not, disregard.
除非用户使用
UIImagePickerController
选择照片,否则您不能这样做。检查此相关问题
You can't, unless the user picks the photo using the
UIImagePickerController
.Check this related question
尝试此代码段进行必要的更改
UIImagePickerController *picker=[[UIImagePickerController alloc] init];
picker.delegate=pickerDelegate;
picker.sourcetype=UIImagepickerControllerSourceTypePhtoLibrary;
try this code segment make the necessay changes
UIImagePickerController *picker=[[UIImagePickerController alloc] init];
picker.delegate=pickerDelegate;
picker.sourcetype=UIImagepickerControllerSourceTypePhtoLibrary;