SDWebImage基本使用和內部細節

2021-08-04 07:18:28 字數 845 閱讀 7377

// 引入相關標頭檔案

#import "uiimageview+webcache.h"

#import "sdwebimagemanager.h"

#import "sdwebimage**********.h"

#import "uiimage+gif.h"

-(void)download

completed:^(uiimage *image, nserror *error, sdimagecachetype cachetype, nsurl *imageurl)

}];// 存放目錄

nslog(@"%@",[nssearchpathfordirectoriesindomains(nscachesdirectory, nsuserdomainmask, yes) lastobject]);

}// 2.只需要簡單獲得一張,可不設定顯示,記憶體快取&磁碟快取

-(void)download2

completed:^(uiimage *image, nserror *error, sdimagecachetype cachetype, bool finished, nsurl *imageurl) ];

}// 3.沒有做任何快取處理

-(void)download3

completed:^(uiimage *image, nsdata *data, nserror *error, bool finished) ];

}];}-(void)gif

// 記憶體警告

// 8.佇列中任務的處理方式:fifo

}

SDWebImage原理和使用

使用場景 以下 在需要監聽網路狀態的方法中使用 afnetworkreachabilitymanager mgr afnetworkreachabilitymanager sharedmanager setitem customitem item setitem customitem item el...

SDWebImage使用入門

要在其它工程中使用有多種方式,最簡單的就是把類,工程的引用新增到其它工程中。步驟如下 l 在其它工程中,工程名字上點出彈出選單。l 選擇add files to l 選擇sdwebimage的工程檔案,選中copy items if needed。l 點add。編譯,通不過。因為缺少了乙個庫的原始碼...

最新版SDWebImage的使用

第二步,在需要的地方匯入標頭檔案 import uiimageview webcache.h 第三步,呼叫sd setimagewithurl 方法快取,注意,這就是新版本的新方法,舊方法是setimagewithurl 下面將幾個方法都介紹一下。1.sd setimagewithurl 快取的基本...