这一篇讲讲不常用的一些方法。

1 sd_setImageWithPreviousCachedImageWithURL: placeholderImage: options: progress: completed:

取得上次缓存的图片,然后作为占位图的参数再次进行一次图片设置。

平面设计培训,网页设计培训,美工培训,游戏开发,动画培训

- (void)sd_setImageWithPreviousCachedImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletionBlock)completedBlock {
    NSString *key = [[SDWebImageManager sharedManager] cacheKeyForURL:url];
    UIImage *lastPreviousCachedImage = [[SDImageCache sharedImageCache] imageFromDiskCacheForKey:key];
    
    [self sd_setImageWithURL:url placeholderImage:lastPreviousCachedImage ?: placeholder options:options progress:progressBlock completed:completedBlock];    
}

平面设计培训,网页设计培训,美工培训,游戏开发,动画培训

网友评论