SDWebImage禁用缓存

2018-08-07  本文已影响52人  倪大头

sd_setImageWithURL加载相同url会从缓存里找,有时url虽然相同但图片资源已经不同了,比如替换头像的时候,这时需要用带options这个参数的方法

- (void)sd_setImageWithURL:(nullable NSURL *)url
          placeholderImage:(nullable UIImage *)placeholder
                   options:(SDWebImageOptions)options NS_REFINED_FOR_SWIFT;

options参数是SDWebImageRefreshCached,这样加载相同url的图片就不会从缓存里找了

更新:
卵用没有

NSData *imgData = [NSData dataWithContentsOfURL:[NSURL URLWithString:_dataDic[@"individual_grade"][@"oss_url"]]];
        bgImg.image = [UIImage imageWithData:imgData];

不用sd了,求老师指教

上一篇 下一篇

猜你喜欢

热点阅读