Instance Method

fetchUIImageWithCompletion:

Delivers the image to the specified completion handler.

Declaration

- (void)fetchUIImageWithCompletion:(void (^)(UIImage *image))completion;

Parameters

completion

The completion handler block that is executed when the image data is available. You must provide this handler. This block has no return value and takes the following parameter:

image

The image data in a UIImage object. If there was an error retrieving the image, this parameter is nil.

Discussion

Use this method to fetch a UIImage object containing the image data. If you do not provide a handler for the completion parameter, this method does nothing.

If the image data is already local to the device and readily available, this method executes your completion handler on the current thread immediately. If the data must be fetched, perhaps because the data must be downloaded from a URL, this method executes your handler asynchronously on an arbitrary thread.