點(diǎn)擊按鈕码邻,將self.imageView上面的image內(nèi)容保存到本地相冊觉壶,并指定判斷保存成功與否的方法imageSavedToPhotosAlbum:didFinishSavingWithError:contextInfo:
- (IBAction)saveImageToAlbum:(id)sender {
UIImageWriteToSavedPhotosAlbum(self.imageView.image, self, @selector(imageSavedToPhotosAlbum:didFinishSavingWithError:contextInfo:), nil);
}
實現(xiàn)imageSavedToPhotosAlbum:didFinishSavingWithError:contextInfo:方法
- (void)imageSavedToPhotosAlbum:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo
{
NSString *message = @"呵呵";
if (!error) {
message = @"成功保存到相冊";
}else
{
message = [error description];
}
NSLog(@"message is %@",message);
}