Skip to content

Instantly share code, notes, and snippets.

@kirbyt
Created October 24, 2012 19:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kirbyt/3948400 to your computer and use it in GitHub Desktop.
Save kirbyt/3948400 to your computer and use it in GitHub Desktop.
WPSImageDownloaderCompletionBlock completion = ^(UIImage *image, NSError *error) {
if (image) {
NSData *pngData = UIImagePNGRepresentation(image);
[[self imageCache] cacheData:pngData forKey:cacheKey cacheLocation:WPSCacheLocationFileSystem];
cell.imageView.image = image;
} else {
ZAssert(error, @"Image download error: %@\n%@", [error localizedDescription], [error userInfo]);
}
};
cell.imageView.image = [self placeholderImage];
WPSImageDownloader *downloader = [[WPSImageDownloader alloc] init];
[downloader setRetryCount:5];
[downloader setCache:[self imageCache]];
[downloader downloadImageAtURL:imageURL completion:completion];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment