SDWebImage . .
.
appDidFinishLauching, lifo .
SDWebImageManager.sharedManager.imageDownloader.executionOrder = SDWebImageDownloaderLIFOExecutionOrder;
view.
#import "UIButton+WebCache.h"
[btn sd_setImageWithURL:[NSURL URLWithString:@"your string"] forState:UIControlStateNormal];
[btn sd_setBackgroundImageWithURL:[NSURL URLWithString:@"your string"] forState:UIControlStateNormal];
,
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"your string with encoding"];
if (data)
{
UIImage *img = [UIImage imageWithData:data];
dispatch_async(dispatch_get_main_queue(), ^{
if (img)
[btn setImage:btn forState:UIControlStateNormal];
});
}
});
SDWebImage, , , .