Ios – How to save picture to iPhone photo library

cameracocoa-touchiosiphoneuiimage

What do I need to do to save an image my program has generated (possibly from the camera, possibly not) to the system photo library on the iPhone?

Best Answer

You can use this function:

UIImageWriteToSavedPhotosAlbum(UIImage *image, 
                               id completionTarget, 
                               SEL completionSelector, 
                               void *contextInfo);

You only need completionTarget, completionSelector and contextInfo if you want to be notified when the UIImage is done saving, otherwise you can pass in nil.

See the official documentation for UIImageWriteToSavedPhotosAlbum().