简体   繁体   English

我的应用程序如何保存和打开iPhone照片库中的照片?

[英]How my app save and open photos from the iPhone's photo library?

How can I save and open photos from the iPhone's photo library from my app? 如何从我的应用程序保存和打开iPhone照片库中的照片? Code would be helpful. 代码会有所帮助。

This allows you to save an image to the photo album: 这使您可以将图像保存到相册中:

// Adds a photo to the saved photos album.  The optional completionSelector should have the form:
//  - (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo;
UIKIT_EXTERN void UIImageWriteToSavedPhotosAlbum(UIImage *image, id completionTarget, SEL completionSelector, void *contextInfo);

(sample code: ) (示例代码:)

IImageWriteToSavedPhotosAlbum( image, self, @selector(image:didFinishSavingWithError:contextInfo:), nil );  


/// called function, alerts user when the image has been saved:

- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo {
    [ [ self parentViewController ] dismissModalViewControllerAnimated: YES];   
}

The best you can do is saved off a picked photo in your own app writable directory, and use that going forward... note that if you save out to the users library multiple times, it will create a new image every time. 最好的办法是将选择的照片保存在您自己的应用程序可写目录中,并继续使用...请注意,如果您多次保存到用户库,则每次都会创建一个新图像。

You may want to file a Radar with Apple to allow direct access to the file, or give you some kind of reference you could use to see the file (to see EXIF for example). 您可能想向Apple提交Radar ,以允许直接访问该文件,或者给您提供某种参考,您可以用来查看该文件(例如,查看EXIF)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM