本文主要是介绍[iOS]保存图片到相册,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
[iOS]保存图片到相册
// 将UIImage保存到本地相册
- (void)saveImageToAlbum {UIImage *image = _imgView.image;UIImageWriteToSavedPhotosAlbum(image, self, @selector(imageSavedToPhotosAlbum:didFinishSavingWithError:contextInfo:), nil);
}//判断是否保存成功
- (void)imageSavedToPhotosAlbum:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo {NSString *message = @"保存失败";if (!error) {message = @"保存成功";} else {message = [error description];}UIAlertView *alert = [[UIAlertView alloc] initWithTitle:message message:nil delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];[alert show];
}
这篇关于[iOS]保存图片到相册的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!