[英]downloading image into NSHomeDirectory by using SDWebImage
__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;
}];
this code can set headpic's image, and I want to download the server image(from imageUrl) to NSHomeDirectory
at the same time, how to do? 该代码可以设置头像的图像,并且我想同时将服务器图像(从imageUrl)下载到
NSHomeDirectory
,该怎么办?
Look at EGOCache for store images locally. 在EGOCache中查找本地存储图像。 https://github.com/enormego/EGOCache You can use default EGOCache directory (inside NSCachesDirectory) or initialize it with your own directory.
https://github.com/enormego/EGOCache您可以使用默认的EGOCache目录(位于NSCachesDirectory内部)或使用您自己的目录对其进行初始化。
Usage is very simple: 用法很简单:
[[EGOCache globalCache] setImage:image forKey:@"your_key"];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.