When i localized iOS app . UIImageView
not showing images at all , These images i downloaded it from urls .
NOTE: i am using AsyncImageView component .
@implementation CategoryView
+ (CategoryView *)getViewWithTitle:(NSString *)title andImageUrl:(NSString *)imgUrl {
CategoryView *view = [[[NSBundle getBundle] loadNibNamed:@"CategoryView" owner:self options:nil] objectAtIndex:0];
[view configureWithTitle:title andImageUrl:imgUrl];
return view;
}
- (void)configureWithTitle:(NSString *)title andImageUrl:(NSString *)imgUrl {
[self bringSubviewToFront:_viewBtn];
self.imageView.layer.cornerRadius = self.imageView.frame.size.width / 2;
self.imageView.clipsToBounds = YES;
self.categoryTitleLabel.text = title;
[self.imageView setImageURL:[NSURL URLWithString:imgUrl]];
}
You can try SDWebImage library and it provides an async image downloader with support to caching.
Some of the features listed in the documentation :
Categories for UIImageView, UIButton, MKAnnotationView adding web image and cache management
An asynchronous image downloader
An asynchronous memory + disk image caching with automatic cache expiration handling
A background image decompression
A guarantee that the same URL won't be downloaded several times
A guarantee that bogus URLs won't be retried again and again
A guarantee that main thread will never be blocked
Performances!
Use GCD and ARC