CocoaPods trunk is moving to be read-only. Read more on the blog, there are 14 months to go.
| TestsTested | ✗ | 
| LangLanguage | Obj-CObjective C | 
| License | MIT | 
| ReleasedLast Release | May 2016 | 
Maintained by Gergő Németh.
R87DownloaderImageView is a UIImageView subclass which makes possible to download an image from the provided link.
While the download is in progress the default or a custom propgress bar is displayed, the download returns a success block with the downloaded image or a failure block in case of an error.
R87DownloaderImageView is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "R87DownloaderImageView"Use this method to start image download from a server:
- (void)downloadImageWithLink:(NSString *)imageLink
             withSuccessBlock:(void(^)(NSData *imageData))successBlock
                 failureBlock:(void(^)(NSError *error))failureBlock;Optionally you can set the image property before the downloadImageWithLink:withSuccessBlock:failureBlock method. In this case the method returns in the success block with nil parameter.
You can set the activityIndicator property before the downloadImageWithLink:withSuccessBlock:failureBlock method. In this case the the provided view vill be displayed while the download is in progress.
You can set the errorImage property before the downloadImageWithLink:withSuccessBlock:failureBlock method. This image will be displayed if an error occures.
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
// set image if exists
NSData *imageData = [userDefaults objectForKey:@"image"];
self.imageView.image = [UIImage imageWithData:imageData];
// set custom loading indicator
UIActivityIndicatorView *activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
[activityIndicator startAnimating];
self.imageView.activityIndicator = activityIndicator;
// set error image
self.imageView.errorImage = [UIImage imageNamed:@"errorImage"];
// download image (does nothing if the image exists)
[self.imageView downloadImageWithLink:@"http://lorempixel.com/400/400/" withSuccessBlock:^(NSData *imageData) {
    [userDefaults setObject:imageData forKey:@"image"];
    [userDefaults synchronize];
} failureBlock:nil];iOS 5.0+
Contributions are always welcome! (:
git checkout -b my-new-feature)git commit -am 'Add some feature')git push origin my-new-feature)The project is under the MIT License.
Gergő Németh (reden87)