cduck
cduck

Reputation: 2691

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? Code would be helpful.

Upvotes: 2

Views: 3137

Answers (2)

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).

Upvotes: 0

justin
justin

Reputation: 868

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];   
}

Upvotes: 1

Related Questions