1.
/*
图片显示
*/
[self.imageView sd_setImageWithURL:[NSURL URLWithString:urlString]];
[self imageCachesWithUrl:[NSURL URLWithString:model.mediumLogo]];
2.
/*
图片缓存
*/
-(void)imageCachesWithUrl:(NSURL*)url{
SDWebImageManager *manager = [SDWebImageManager sharedManager];
[manager downloadImageWithURL:url options:SDWebImageRetryFailed progress:^(NSInteger receivedSize, NSInteger expectedSize) {
NSLog(@"显示当前进度");
} completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {
NSLog(@"下载完成");
}];
}
3./*
清理图片缓存
*/
float tmpSize = [[SDImageCache sharedImageCache] getSize];
[[SDImageCache sharedImageCache] clearDisk];
// float tmpSize = [[SDImageCache sharedImageCache]checkTmpSize];
// [[SDWebImageManager sharedManager].imageCache clearMemory];
// float tmpSize= [SDWebImageManager sharedManager].imageCache.getSize;
NSString *clearCacheName = tmpSize >= 1 ? [NSString stringWithFormat:@"清理缓存(%.2fM)",tmpSize/1000000] : [NSString stringWithFormat:@"清理缓存(%.2fK)",tmpSize/1000];
NSLog(@"%@",clearCacheName);