SDWebImage获取网络图片的size



SDWebImageManager *manager = [SDWebImageManager sharedManager];

//  判断是否有缓存
[manager diskImageExistsForURL:imageUrl completion:^(BOOL isInCache) {
UIImage * image;
if (isInCache) {
image = [[manager imageCache] imageFromDiskCacheForKey:imageUrl.absoluteString];
//                    NSLog(@"有缓存");
}else{
//                    NSLog(@"没缓存");
NSData *data = [NSData dataWithContentsOfURL:imageUrl];
image = [UIImage imageWithData:data];
}
CGSize gsize = image.size;
//                NSLog(@"image 宽%g  高%g  isInCache %d",gsize.width,gsize.height,isInCache);



}];



Loading Disqus comments...
Table of Contents