How to save UIImage into iPhone’s saved photos album?

This is quite simple, infact it is one row code like everything else in iPhone development. Well, not everything is “quite” simple as this but most of stuff is “quite” easy to implement. Enough with “quite” ! Here is really simple code;
UIImage *myImage = [UIImage imageNamed:@"me.png"];
UIImageWriteToSavedPhotosAlbum(myImage, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);
// And if you wish add this selector method in code;
- (void) image:(UIImage*)image didFinishSavingWithError:(NSError *)error contextInfo:(NSDictionary*)info;
That’s all you have to add! Quite simple, is it? 🙂
Published in:
Leave a comment
5 comments
Thank You… It solved my problem.
Thank you so much for the code snippet. It was really helpful.
One small question, how can we know the status of it? Whether it is success or not?
Thank you for this post! I have a question though.
I put the code into my button action:
– (IBAction)savePhotoSignature:(id)sender {
UIImage *myImage = [UIImage imageNamed:@”me.png”];
UIImageWriteToSavedPhotosAlbum(myImage, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);
}
And I can’t find the image anywhere. Am I doing something wrong?
thank u so much…..its working….:)
what I saved are all “jpg”
How can I save a UIImage as “png”