1.代码
- (void)loadImageFinished:(UIImage *)image
{
UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), (__bridge void *)self);
}
- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo
{
NSLog(@"image = %@, error = %@, contextInfo = %@", image, error, contextInfo);
}
2.调用loadImageFinished方法并传入要保存的图片即可
本文介绍了一个简单的 iOS 应用中保存图片到相册的方法。通过实现 loadImageFinished 方法,并使用 UIImageWriteToSavedPhotosAlbum 函数完成图片保存。此外,还提供了一个回调方法用于保存完成后错误的处理。

8万+

被折叠的 条评论
为什么被折叠?



