- (void)downloadAction:(UIButton*)sender{
[[SDWebImageManagersharedManager]downloadImageWithURL:[NSURLURLWithString:self.model.url]options:0progress:^(NSIntegerreceivedSize, NSInteger expectedSize) {
NSLog(@"处理下载进度");
} completed:^(UIImage*image, NSError *error, SDImageCacheType cacheType,BOOL finished, NSURL *imageURL) {
if (error) {
NSLog(@"%@",error);
}
if (image) {
//将图片写入相册中
UIImageWriteToSavedPhotosAlbum(image,self,@selector(imageSavedToPhotosAlbum:didFinishSavingWithError:contextInfo:),nil);
NSLog(@"图片操作");
}
}];
}
- (void)imageSavedToPhotosAlbum:(UIImage*)image didFinishSavingWithError:(NSError*)error contextInfo:(void*)contextInfo
{
NSString *message = @"呵呵";
if (!error) {
message = @"成功保存到相册";
}else
{
message = [error description];
}
NSLog(@"message is %@",message);
}
图片下载到相机中
最新推荐文章于 2023-09-18 10:36:37 发布