码迷,mamicode.com
首页 > Web开发 > 详细

sdwebimage

时间:2016-06-20 22:13:29      阅读:215      评论:0      收藏:0      [点我收藏+]

标签:

[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];
}

 

sdwebimage

标签:

原文地址:http://www.cnblogs.com/jingdizhiwa/p/5601757.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!