- (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);
}
圖片下載到相機中
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.