iOS SDWebImage SDWebImageOptions

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圖片

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末财忽,一起剝皮案震驚了整個(gè)濱河市倘核,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌即彪,老刑警劉巖笤虫,帶你破解...
    沈念sama閱讀 221,273評(píng)論 6 515
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場離奇詭異祖凫,居然都是意外死亡,警方通過查閱死者的電腦和手機(jī)酬凳,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 94,349評(píng)論 3 398
  • 文/潘曉璐 我一進(jìn)店門惠况,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人宁仔,你說我怎么就攤上這事稠屠。” “怎么了翎苫?”我有些...
    開封第一講書人閱讀 167,709評(píng)論 0 360
  • 文/不壞的土叔 我叫張陵权埠,是天一觀的道長。 經(jīng)常有香客問我煎谍,道長攘蔽,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 59,520評(píng)論 1 296
  • 正文 為了忘掉前任呐粘,我火速辦了婚禮满俗,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘作岖。我一直安慰自己唆垃,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 68,515評(píng)論 6 397
  • 文/花漫 我一把揭開白布痘儡。 她就那樣靜靜地躺著辕万,像睡著了一般。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上渐尿,一...
    開封第一講書人閱讀 52,158評(píng)論 1 308
  • 那天醉途,我揣著相機(jī)與錄音,去河邊找鬼涡戳。 笑死结蟋,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的渔彰。 我是一名探鬼主播嵌屎,決...
    沈念sama閱讀 40,755評(píng)論 3 421
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢(mèng)啊……” “哼恍涂!你這毒婦竟也來了宝惰?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 39,660評(píng)論 0 276
  • 序言:老撾萬榮一對(duì)情侶失蹤再沧,失蹤者是張志新(化名)和其女友劉穎尼夺,沒想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體炒瘸,經(jīng)...
    沈念sama閱讀 46,203評(píng)論 1 319
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡淤堵,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 38,287評(píng)論 3 340
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了顷扩。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片拐邪。...
    茶點(diǎn)故事閱讀 40,427評(píng)論 1 352
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖隘截,靈堂內(nèi)的尸體忽然破棺而出扎阶,到底是詐尸還是另有隱情,我是刑警寧澤婶芭,帶...
    沈念sama閱讀 36,122評(píng)論 5 349
  • 正文 年R本政府宣布东臀,位于F島的核電站,受9級(jí)特大地震影響犀农,放射性物質(zhì)發(fā)生泄漏惰赋。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,801評(píng)論 3 333
  • 文/蒙蒙 一呵哨、第九天 我趴在偏房一處隱蔽的房頂上張望谤逼。 院中可真熱鬧,春花似錦仇穗、人聲如沸流部。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,272評(píng)論 0 23
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽枝冀。三九已至,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間果漾,已是汗流浹背球切。 一陣腳步聲響...
    開封第一講書人閱讀 33,393評(píng)論 1 272
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留绒障,地道東北人吨凑。 一個(gè)月前我還...
    沈念sama閱讀 48,808評(píng)論 3 376
  • 正文 我出身青樓,卻偏偏與公主長得像户辱,于是被迫代替她去往敵國和親鸵钝。 傳聞我的和親對(duì)象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,440評(píng)論 2 359

推薦閱讀更多精彩內(nèi)容

  • 1庐镐、通過CocoaPods安裝項(xiàng)目名稱項(xiàng)目信息 AFNetworking網(wǎng)絡(luò)請(qǐng)求組件 FMDB本地?cái)?shù)據(jù)庫組件 SD...
    陽明先生_X自主閱讀 15,985評(píng)論 3 119
  • 1.ios高性能編程 (1).內(nèi)層 最小的內(nèi)層平均值和峰值(2).耗電量 高效的算法和數(shù)據(jù)結(jié)構(gòu)(3).初始化時(shí)...
    歐辰_OSR閱讀 29,405評(píng)論 8 265
  • 項(xiàng)目中一直都有使用SDWebImage恩商,對(duì)這個(gè)框架有一定的了解,但是體系卻未能貫通必逆,因此特地整理下,主要參考: i...
    林大鵬閱讀 1,471評(píng)論 2 13
  • 在這個(gè)匆忙的城市里怠堪,白天的時(shí)光總是眨眼即過,還沒來得及生活名眉,就已是被生活拖進(jìn)了夜里粟矿。 細(xì)細(xì)想來,人...
    醬醋茶七七閱讀 309評(píng)論 0 2
  • 早安损拢!又是一夜只睡了三個(gè)小時(shí)嚷炉,為了今天上午三個(gè)小時(shí)的課程。盡管昨天寫了文章探橱,說要白天把課程備好,改變自己這個(gè)臨時(shí)突...
    綻蕊向陽閱讀 146評(píng)論 0 0