美文网首页
SDWebImage 不要缓存,及时刷新图片。

SDWebImage 不要缓存,及时刷新图片。

作者: 减苏 | 来源:发表于2015-11-26 14:46 被阅读1908次

    这个可能要用到客户端的多次登录密码不正确,会出现验证码,验证码输入不正确后验证码要及时刷新。


    [ImageView sd_setImageWithURL:[NSURL URLWithString:model.vcode_url] placeholderImage:nil options:SDWebImageCacheMemoryOnly | SDWebImageRefreshCached];

    用这个API需要修改内部的一些代码:

    @sourcebits-mahesh @tbrknt

    go to SDWebImageManager.m file inside the downloadImageWithURL method from line 176 and change this

    if (image && options & SDWebImageRefreshCached) {

    // force progressive off if image already cached but forced refreshing

    downloaderOptions &= ~SDWebImageDownloaderProgressiveDownload;

    // ignore image read from NSURLCache if image if cached but force refreshing

    downloaderOptions |= SDWebImageDownloaderIgnoreCachedResponse;

    }

    to this:

    if (image && options & SDWebImageRefreshCached) {

    // force progressive off if image already cached but forced refreshing

    downloaderOptions &= ~SDWebImageDownloaderProgressiveDownload;

    // remove SDWebImageDownloaderUseNSURLCache flag

    downloaderOptions &= ~SDWebImageDownloaderUseNSURLCache;

    // ignore image read from NSURLCache if image is cached but force refreshing

    downloaderOptions |= SDWebImageDownloaderIgnoreCachedResponse;

    }


    over...........

    相关文章

      网友评论

          本文标题:SDWebImage 不要缓存,及时刷新图片。

          本文链接:https://www.haomeiwen.com/subject/galdhttx.html