Before looking at some open source code, there is a function, is to download pictures to the album, carefully read the code, only a very simple sentence, and after saving, you can also determine whether to save the success.
As the following code shows,
Click the button to save the image above Self.imageview to your local album and specify a method to determine the success of the Save Imagesavedtophotosalbum:didfinishsavingwitherror: ContextInfo:
- (Ibaction) Saveimagetoalbum: (Id) Sender {
Uiimagewritetosavedphotosalbumse Lf Imageviewimageself @selector nil);
}
Implementing ImageSavedToPhotosAlbum:didFinishSavingWithError:contextInfo: Methods
- (void) Imagesavedtophotosalbum: (UIImage*) Image didfinishsavingwitherror: (Nserror*) Error ContextInfo: (void*) ContextInfo
{
NSString*message =@"Oh";
If(!error) {
Message =@" successfully saved to album " }
{
message = [Error description }
nslog (@ "message is%@" ,message);
}
The code is simple, if there is no error, prompt "successfully saved to the album", if the save fails, then output error message ["Error description]."
IOS Photos saved to albums