我的应用程序如何保存和打开iPhone上的照片';s照片库?
如何从我的应用程序中保存和打开iPhone照片库中的照片?我的应用程序如何保存和打开iPhone上的照片';s照片库?,iphone,objective-c,cocoa-touch,Iphone,Objective C,Cocoa Touch,如何从我的应用程序中保存和打开iPhone照片库中的照片? 代码会很有帮助。这允许您将图像保存到相册中: // Adds a photo to the saved photos album. The optional completionSelector should have the form: // - (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)co
代码会很有帮助。这允许您将图像保存到相册中:
// 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);
(示例代码:)
你能做的最好的事情就是把一张精选的照片保存在你自己的应用程序可写目录中,并继续使用它。。。请注意,如果多次保存到用户库,则每次都会创建一个新图像
你可能想向苹果公司提交一份文件,以便直接访问该文件,或者给你一些可以用来查看该文件的参考资料(例如查看EXIF)。下次我启动我的应用程序时,如果用户不必从UIImagePickerController中选择图像,如何重新打开该图像?不幸的是,在进行了一些挖掘之后,对于通过AppStore发布的应用程序,这可能是不可能的。您可以将它们保存到相册和自己的目录中(并且您可以毫无问题地打开自己目录中的相册),但应用程序似乎无权访问相机的相册。
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];
}