iOS Development Sdwebimageoptions Understanding

Source: Internet
Author: User

typedef ns_options (Nsuinteger, sdwebimageoptions) {    sdwebimageretryfailed = 1 << 0,    sdwebimagelowpriority = 1 << 1,    sdwebimagecachememoryonly = 1 << 2,    sdwebimageprogressivedownload = 1 << 3,    sdwebimagerefreshcached = 1 << 4,    sdwebimagecontinueinbackground = 1 << 5,    Sdwebimagehandlecookies = 1 << 6,    sdwebimageallowinvalidsslcertificates = 1 << 7,    sdwebimagehighpriority = 1 << 8,    sdwebimagedelayplaceholder = 1 << 9,    Sdwebimagetransformanimatedimage = 1 <<,    sdwebimageavoidautosetimage = 1 << 11};

SDWebImageRetryFailed = 1 << 0,

默认情况下,如果一个url在下载的时候失败了,那么这个url会被加入黑名单并且library不会尝试再次下载,这个flag会阻止library把失败的url加入黑名单(简单来说如果选择了这个flag,那么即使某个url下载失败了,sdwebimage还是会尝试再次下载他

SDWebImageLowPriority = 1 << 1,

默认情况下,图片会在交互发生的时候下载(例如你滑动tableview的时候),这个flag会禁止这个特性,导致的结果就是在scrollview减速的时候,才会开始下载(也就是你滑动的时候scrollview不下载,你手从屏幕上移走,scrollview开始减速的时候才会开始下载图片


sdwebimagecachememoryonly = 1 << 2,

这个flag禁止磁盘缓存,只有内存缓存

SDWebImageProgressiveDownload = 1 << 3,

这个flag会在图片下载的时候就显示(就像你用浏览器浏览网页的时候那种图片下载,一截一截的显示(待确认))

SDWebImageRefreshCached = 1 << 4,

一个图片缓存了,还是会重新请求.并且缓存侧略依据NSURLCache而不是SDWebImage.URL不变,图片会更新时使用

SDWebImageContinueInBackground = 1 << 5,

启动后台下载,加入你进入一个页面,有一张图片正在下载这时候你让app进入后台,图片还是会继续下载(这个估计要开backgroundfetch才有用)

SDWebImageHandleCookies = 1 << 6,

可以控制存在NSHTTPCookieStore的cookies.

SDWebImageAllowInvalidSSLCertificates = 1 << 7,

允许不安全的SSL证书,在正式环境中慎用

SDWebImageHighPriority = 1 << 8,

默认情况下,image在装载的时候是按照他们在队列中的顺序装载的(就是先进先出).这个flag会把他们移动到队列的前端,并且立刻装载,而不是等到当前队列装载的时候再装载.

SDWebImageDelayPlaceholder = 1 << 9,

默认情况下,占位图会在图片下载的时候显示.这个flag开启会延迟占位图显示的时间,等到图片下载完成之后才会显示占位图.

SDWebImageTransformAnimatedImage = 1 << 10,

是否transform图片

iOS Development Sdwebimageoptions Understanding

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.