CKNetworkImageDownloading Protocol Reference

Conforms to NSObject
Declared in CKNetworkImageDownloading.h

Overview

Downloads images for a network image component.

– downloadImageWithURL:caller:callbackQueue:downloadProgressBlock:completion: required method

Downloads an image with the given URL.

- (id)downloadImageWithURL:(NSURL *)URL caller:(id)caller callbackQueue:(dispatch_queue_t)callbackQueue downloadProgressBlock:(void ( ^ ) ( CGFloat progress ))downloadProgressBlock completion:(void ( ^ ) ( CGImageRef image , NSError *error ))completion

Parameters

URL

The URL of the image to download.

caller

The object that initiated the request.

callbackQueue

The queue to call downloadProgressBlock and completion on. If this value is nil, both blocks will be invoked on the main-queue.

downloadProgressBlock

The block to be invoked when the download of URL progresses. Receives the progress of the download, in the range of (0.0, 1.0), inclusive.

completion

The block to be invoked when the download has completed, or has failed. Receives: - image that was downloaded, if the image could be successfully downloaded; nil otherwise. - error describing why the download of URL failed, if the download failed; nil otherwise.

Return Value

An opaque identifier to be used in canceling the download, via cancelImageDownload:. You must retain the identifier if you wish to use it later.

Discussion

If URL is nil, completion will be invoked immediately with a nil image and an error describing why the download failed.

Declared In

CKNetworkImageDownloading.h

– cancelImageDownload: required method

Cancels an image download.

- (void)cancelImageDownload:(id)download

Parameters

download

The opaque download identifier object returned from downloadImageWithURL:caller:callbackQueue:downloadProgressBlock:completion:.

Discussion

This method has no effect if download is nil.

Declared In

CKNetworkImageDownloading.h