iOS基础(九)——保存图片到本地

1、保存图片到本地

#pragma mark ==========保存图片==========
- (void)loadImageFinished:(UIImage *)image
{
    UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), (__bridge void *)self);
}

- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo
{
    [MBProgressHUD showSuccessMessage:@"图片已保存到相册"];
    NSLog(@"image = %@, error = %@, contextInfo = %@", image, error, contextInfo);
}

2、要设置访问权限

posted @ 2018-08-29 15:19  明似水  阅读(140)  评论(0编辑  收藏  举报