SDWebImage-SDWebImageOptions
typedef NS_OPTIONS(NSUInteger, SDWebImageOptions) {
/**
* By default, when a URL fail to be downloaded, the URL is blacklisted so the library won't keep trying.
* This flag disable this blacklisting.
*/
SDWebImageRetryFailed = 1 << 0,
/**
* By default, image downloads are started during UI interactions, this flags disable this feature,
* leading to delayed download on UIScrollView deceleration for instance.
*/
SDWebImageLowPriority = 1 << 1,
/**
* This flag disables on-disk caching
*/
SDWebImageCacheMemoryOnly = 1 << 2,
/**
* This flag enables progressive download, the image is displayed progressively during download as a browser would do.
* By default, the image is only displayed once completely downloaded.
*/
SDWebImageProgressiveDownload = 1 << 3,
/**
* Even if the image is cached, respect the HTTP response cache control, and refresh the image from remote location if needed.
* The disk caching will be handled by NSURLCache instead of SDWebImage leading to slight performance degradation.
* This option helps deal with images changing behind the same request URL, e.g. Facebook graph api profile pics.
* If a cached image is refreshed, the completion block is called once with the cached image and again with the final image.
*
* Use this flag only if you can't make your URLs static with embedded cache busting parameter.
*/
SDWebImageRefreshCached = 1 << 4,
/**
* In iOS 4+, continue the download of the image if the app goes to background. This is achieved by asking the system for
* extra time in background to let the request finish. If the background task expires the operation will be cancelled.
*/
SDWebImageContinueInBackground = 1 << 5,
/**
* Handles cookies stored in NSHTTPCookieStore by setting
* NSMutableURLRequest.HTTPShouldHandleCookies = YES;
*/
SDWebImageHandleCookies = 1 << 6,
/**
* Enable to allow untrusted SSL certificates.
* Useful for testing purposes. Use with caution in production.
*/
SDWebImageAllowInvalidSSLCertificates = 1 << 7,
/**
* By default, images are loaded in the order in which they were queued. This flag moves them to
* the front of the queue.
*/
SDWebImageHighPriority = 1 << 8,
/**
* By default, placeholder images are loaded while the image is loading. This flag will delay the loading
* of the placeholder image until after the image has finished loading.
*/
SDWebImageDelayPlaceholder = 1 << 9,
/**
* We usually don't call transformDownloadedImage delegate method on animated images,
* as most transformation code would mangle it.
* Use this flag to transform them anyway.
*/
SDWebImageTransformAnimatedImage = 1 << 10,
/**
* By default, image is added to the imageView after download. But in some cases, we want to
* have the hand before setting the image (apply a filter or add it with cross-fade animation for instance)
* Use this flag if you want to manually set the image in the completion when success
*/
SDWebImageAvoidAutoSetImage = 1 << 11
};
SDWebImageRetryFailed = 1 << 0
默認(rèn)情況下,如果一個(gè)url在下載的時(shí)候失敗了,那么這個(gè)url會(huì)被加入黑名單并且library不會(huì)嘗試再次下載,這個(gè)flag會(huì)阻止library把失敗的url加入黑名單(簡單來說如果選擇了這個(gè)flag,那么即使某個(gè)url下載失敗了,sdwebimage還是會(huì)嘗試再次下載他
SDWebImageLowPriority = 1 << 1
默認(rèn)情況下,圖片會(huì)在交互發(fā)生的時(shí)候下載(例如你滑動(dòng)tableview的時(shí)候),這個(gè)flag會(huì)禁止這個(gè)特性,導(dǎo)致的結(jié)果就是在scrollview減速的時(shí)候,才會(huì)開始下載(也就是你滑動(dòng)的時(shí)候scrollview不下載,你手從屏幕上移走,scrollview開始減速的時(shí)候才會(huì)開始下載圖片
SDWebImageCacheMemoryOnly = 1 << 2
這個(gè)flag禁止磁盤緩存,只有內(nèi)存緩存
SDWebImageProgressiveDownload = 1 << 3
這個(gè)flag會(huì)在圖片下載的時(shí)候就顯示(就像你用瀏覽器瀏覽網(wǎng)頁的時(shí)候那種圖片下載,一截一截的顯示(待確認(rèn)))
SDWebImageRefreshCached = 1 << 4
一個(gè)圖片緩存了,還是會(huì)重新請(qǐng)求.并且緩存?zhèn)嚷砸罁?jù)NSURLCache而不是SDWebImage.URL不變,圖片會(huì)更新時(shí)使用
SDWebImageContinueInBackground = 1 << 5
啟動(dòng)后臺(tái)下載,加入你進(jìn)入一個(gè)頁面,有一張圖片正在下載這時(shí)候你讓app進(jìn)入后臺(tái),圖片還是會(huì)繼續(xù)下載(這個(gè)估計(jì)要開backgroundfetch才有用)
SDWebImageHandleCookies = 1 << 6
可以控制存在NSHTTPCookieStore的cookies.
SDWebImageAllowInvalidSSLCertificates = 1 << 7
允許不安全的SSL證書,在正式環(huán)境中慎用
SDWebImageHighPriority = 1 << 8
默認(rèn)情況下,image在裝載的時(shí)候是按照他們?cè)陉?duì)列中的順序裝載的(就是先進(jìn)先出).這個(gè)flag會(huì)把他們移動(dòng)到隊(duì)列的前端,并且立刻裝載,而不是等到當(dāng)前隊(duì)列裝載的時(shí)候再裝載.
SDWebImageDelayPlaceholder = 1 << 9
默認(rèn)情況下,占位圖會(huì)在圖片下載的時(shí)候顯示.這個(gè)flag開啟會(huì)延遲占位圖顯示的時(shí)間,等到圖片下載完成之后才會(huì)顯示占位圖.
SDWebImageTransformAnimatedImage = 1 << 10
是否transform圖片