Inherits from NSObject
Declared in SDWebImageDownloader.h
SDWebImageDownloader.m

Overview

Asynchronous downloader dedicated and optimized for image loading.

Properties

currentDownloadCount

Shows the current amount of downloads that still need to be downloaded

@property (readonly, nonatomic) NSUInteger currentDownloadCount

Declared In

SDWebImageDownloader.h

downloadTimeout

The timeout value (in seconds) for the download operation. Default: 15.0.

@property (assign, nonatomic) NSTimeInterval downloadTimeout

Declared In

SDWebImageDownloader.h

executionOrder

Changes download operations execution order. Default value is SDWebImageDownloaderFIFOExecutionOrder.

@property (assign, nonatomic) SDWebImageDownloaderExecutionOrder executionOrder

Declared In

SDWebImageDownloader.h

headersFilter

Set filter to pick headers for downloading image HTTP request.

@property (nonatomic, strong) NSDictionary *^ ) ( NSURL *url , NSDictionary *headers ) headersFilter

Discussion

This block will be invoked for each downloading image request, returned NSDictionary will be used as headers in corresponding HTTP request.

Declared In

SDWebImageDownloader.h

Instance Methods

downloadImageWithURL:options:progress:completed:

Creates a SDWebImageDownloader async downloader instance with a given URL

- (id<SDWebImageOperation>)downloadImageWithURL:(NSURL *)url options:(SDWebImageDownloaderOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageDownloaderCompletedBlock)completedBlock

Parameters

url

The URL to the image to download

options

The options to be used for this download

progressBlock

A block called repeatedly while the image is downloading

completedBlock

A block called once the download is completed. If the download succeeded, the image parameter is set, in case of error, error parameter is set with the error. The last parameter is always YES if SDWebImageDownloaderProgressiveDownload isn’t use. With the SDWebImageDownloaderProgressiveDownload option, this block is called repeatedly with the partial image object and the finished argument set to NO before to be called a last time with the full image and finished argument set to YES. In case of error, the finished argument is always YES.

Return Value

A cancellable SDWebImageOperation

Discussion

The delegate will be informed when the image is finish downloaded or an error has happen.

Declared In

SDWebImageDownloader.h

setValue:forHTTPHeaderField:

Set a value for a HTTP header to be appended to each download HTTP request.

- (void)setValue:(NSString *)value forHTTPHeaderField:(NSString *)field

Parameters

value

The value for the header field. Use nil value to remove the header.

field

The name of the header field to set.

Declared In

SDWebImageDownloader.h

valueForHTTPHeaderField:

Returns the value of the specified HTTP header field.

- (NSString *)valueForHTTPHeaderField:(NSString *)field

Return Value

The value associated with the header field field, or nil if there is no corresponding header field.

Declared In

SDWebImageDownloader.h