SDWebImage 下載圖片

//下載圖片獲取下載進度??

//頭文件導入

[self.myimage sd_setImageWithURL:[NSURL URLWithString:@""] placeholderImage:[UIImage imageNamed:@""] options:0 progress:^(NSInteger receivedSize, NSInteger expectedSize) {? ? ? ? ? ? } completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {? ? ? ? ? ? }];? ?

//只需要簡單獲取圖片

//內存緩存&磁盤緩存? ? 頭文件導入

[[SDWebImageManager sharedManager]downloadImageWithURL:[NSURL URLWithString:@""] options:0 progress:^(NSInteger receivedSize, NSInteger expectedSize) {? ? ? ? ? ? } completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {? ? ? ? self.myimage.image = image;

? }];? ?

//不需要任務的緩存處理? 頭文件導入

[[SDWebImageDownloader sharedDownloader]downloadImageWithURL:[NSURL URLWithString:@""] options:0 progress:^(NSInteger receivedSize, NSInteger expectedSize) {

} completed:^(UIImage *image, NSData *data, NSError *error, BOOL finished) {

[[NSOperationQueue mainQueue]addOperationWithBlock:^{

self.myimage.image = image;

}];

}];

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容