Use Sdwebimage to load different pictures but the URL of the picture is the same

Source: Internet
Author: User

The point is in the sdwebimagemanager.m file, about 176 lines

On the basis of (using sdwebimagerefreshcached), modify the SD library


if (Image && options & sdwebimagerefreshcached) {//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;< c3/>}




Add this section of code//Remove Sdwebimagedownloaderusensurlcache flag downloaderoptions &= ~sdwebimagedownloaderusensurlcache;


if (Image && options & sdwebimagerefreshcached) {//progressive off if image already cached but forced refreshing downloaderoptions &= ~sdwebimagedownloaderprogressivedownload; Yes, that's it.//Ignore image read from Nsurlcache if image if cached and force refreshing downloaderoptions |= Sdwebimagedownlo Aderignorecachedresponse;}

Author: Yang Prawn
Links: https://www.jianshu.com/p/3c95baccaf61
Source: Pinterest
Copyright belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source. if (Image && options & sdwebimagerefreshcached) {//progressive off if image already cached but forced refreshing downloaderoptions &= ~sdwebimagedownloaderprogressivedownload; Yes, that's it.//Ignore image read from Nsurlcache if image if cached and force refreshing downloaderoptions |= Sdwebimagedownlo Aderignorecachedresponse;}

Author: Yang Prawn
Links: https://www.jianshu.com/p/3c95baccaf61
Source: Pinterest
Copyright belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source. if (Image && options & sdwebimagerefreshcached) {//progressive off if image already cached but forced refreshing downloaderoptions &= ~sdwebimagedownloaderprogressivedownload; Yes, that's it.//Ignore image read from Nsurlcache if image if cached and force refreshing downloaderoptions |= Sdwebimagedownlo Aderignorecachedresponse;}

Author: Yang Prawn
Links: https://www.jianshu.com/p/3c95baccaf61
Source: Pinterest
Copyright belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source. if (Image && options & sdwebimagerefreshcached) {//progressive off if image already cached but forced refreshing downloaderoptions &= ~sdwebimagedownloaderprogressivedownload; Yes, that's it.//Ignore image read from Nsurlcache if image if cached and force refreshing downloaderoptions |= Sdwebimagedownlo Aderignorecachedresponse;}

Author: Yang Prawn
Links: https://www.jianshu.com/p/3c95baccaf61
Source: Pinterest
Copyright belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source.

if (Image && options & sdwebimagerefreshcached) {//progressive off if image already cached but forced Refreshing
downloaderoptions &= ~sdwebimagedownloaderprogressivedownload; 

Yes, that's it.//Ignore image read from Nsurlcache if image if cached and force refreshing downloaderoptions |= Sdwebimagedo 
Wnloaderignorecachedresponse; 
}


At last


if (Image && options & sdwebimagerefreshcached) {//progressive off if image already cached but forced Refreshing 
downloaderoptions &= ~sdwebimagedownloaderprogressivedownload;
//Remove Sdwebimagedownloaderusensurlcache flag 
downloaderoptions &= ~sdwebimagedownloaderusensurlcache;//Ignore Image read from Nsurlcache if image if cached but force 
refreshing downloaderoptions |= Sdwebimagedownloaderignorecach Edresponse; 
}
The second workaround is to change the "extra header" to achieveiOS development ~sdwebimage is how to do URL unchanged, update the content of the picture

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.