Skip to content

Instantly share code, notes, and snippets.

@bluebanboom
Created November 9, 2012 05:55
Show Gist options
  • Save bluebanboom/4043962 to your computer and use it in GitHub Desktop.
Save bluebanboom/4043962 to your computer and use it in GitHub Desktop.
Save UIImage to photos album.
- (void)savedPhotoImage:(UIImage*)image didFinishSavingWithError:(NSError *)error contextInfo: (void *)contextInfo {
UIAlertView *alert = nil;
if (error == nil) {
alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"图片保存成功!" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil];
}
else {
NSLog(@"%@", [error localizedDescription]);
NSLog(@"info: %@", contextInfo);
alert = [[UIAlertView alloc] initWithTitle:@"错误" message:@"图片保存失败,请重试!" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil];
}
[alert show];
[alert release];
}
- (IBAction)saveBtnClicked:(id)sender
{
UIImageWriteToSavedPhotosAlbum([_imageScrollController currentImage], self, @selector(savedPhotoImage:didFinishSavingWithError:contextInfo:), nil);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment