标签:
[cell.imageView sd_setImageWithURL:[NSURL URLWithString:app.icon] placeholderImage:[UIImage imageNamed:@"placeholder"] options:0 progress:^(NSInteger receivedSize, NSInteger expectedSize) { // expectedSize: 图片的总字节数 // receivedSize: 已经接收的图片字节数 NSLog(@"下载进度:%f", 1.0 * receivedSize / expectedSize); } completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) { NSLog(@"下载完图片"); }];
[[SDWebImageManager sharedManager] downloadImageWithURL:nil options:0 progress:^(NSInteger receivedSize, NSInteger expectedSize) { } completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { }]; // SDWebImage的图片缓存周期是多长:1个星期
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application { // 清除内存缓存 [[SDWebImageManager sharedManager].imageCache clearMemory]; // 取消所有下载 [[SDWebImageManager sharedManager] cancelAll]; }
标签:
原文地址:http://www.cnblogs.com/jingdizhiwa/p/5601757.html