【发布时间】:2014-06-23 12:53:54
【问题描述】:
__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,怎么办?
【问题讨论】:
-
那么您是在问如何将
UIImage保存到文件中? -
@trojanfoe 感谢您的回复,我想我明白了。
标签: ios objective-c sdwebimage