0
__block UIActivityIndicatorView *activityIndicator;
__weak UIImageView *weakImageView = self.headpic;
[self.headpic setImageWithURL:imageUrl placeholderImage:nil options:SDWebImageProgressiveDownload progress:^(NSInteger receivedSize, NSInteger expectedSize){
if (!activityIndicator) {
[weakImageView addSubview:activityIndicator = [UIActivityIndicatorView.alloc initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]];
activityIndicator.center = weakImageView.center;
[activityIndicator startAnimating];
}
}
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType){
[activityIndicator removeFromSuperview];
activityIndicator = nil;
}];
這個代碼可以設置headpic的形象,我想(從IMAGEURL)服務器映像下載到NSHomeDirectory
在同一時間,怎麼辦?下載圖像到NSHomeDirectory使用SDWebImage
所以你問如何保存'UIImage'到文件? – trojanfoe
@trojanfoe感謝您的回覆,我想我明白了。 – yegomo