Added a new constructor to SDWebImagePrefetcher

that allows it to be instantiated with any image manager
This commit is contained in:
KonstantinosK 2015-09-29 10:27:09 +03:00
parent 60cab8b74c
commit 944fd77965
2 changed files with 10 additions and 1 deletions

View File

@ -70,6 +70,11 @@ typedef void(^SDWebImagePrefetcherCompletionBlock)(NSUInteger noOfFinishedUrls,
*/
+ (SDWebImagePrefetcher *)sharedImagePrefetcher;
/**
* Allows you to instantiate a prefetcher with any arbitrary image manager.
*/
- (id)initWithImageManager:(SDWebImageManager *)manager;
/**
* Assign list of URLs to let SDWebImagePrefetcher to queue the prefetching,
* currently one image is downloaded at a time,

View File

@ -37,8 +37,12 @@
}
- (id)init {
return [self initWithImageManager:[SDWebImageManager new]];
}
- (id)initWithImageManager:(SDWebImageManager *)manager {
if ((self = [super init])) {
_manager = [SDWebImageManager new];
_manager = manager;
_options = SDWebImageLowPriority;
_prefetcherQueue = dispatch_get_main_queue();
self.maxConcurrentDownloads = 3;