Question

How can I save the images to iPad's Gallery, and again read them from there into my App. Is it possible to create a folder structure in iPad's gallery where I could store images generated through my app.

Actually I am able to save the images to gallery, I am using this

UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);

But don't know how to load it back into app from gallery. ?

Was it helpful?

Solution

Use the ALAssetsLibrary, then you can call writeImageToSavedPhotosAlbum:metadata:completionBlock: to save the image and in the completion block you get the assetURL. This can later be used to get the image back from the library.


Docs are here .

To get the image for the asset url:

[self.assetsLibrary assetForURL:imageURL resultBlock:^(ALAsset *asset) {
    if (asset != nil) {
        imageView.image = [UIImage imageWithCGImage:[[asset defaultRepresentation] fullScreenImage]];
     }
} failureBlock:^(NSError * error) {
    NSLog (@"Error getting image asset: %@", error);
}];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top