From 10c44577f606c357efde5f379ae33e307550738b Mon Sep 17 00:00:00 2001 From: Olivier Poitrey Date: Tue, 20 Nov 2012 14:49:27 +0100 Subject: [PATCH] Fix SDWebImagePrefetcher maxConcurrentDownloads property --- SDWebImage/SDWebImagePrefetcher.m | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/SDWebImage/SDWebImagePrefetcher.m b/SDWebImage/SDWebImagePrefetcher.m index 95f4b5d2..73645776 100644 --- a/SDWebImage/SDWebImagePrefetcher.m +++ b/SDWebImage/SDWebImagePrefetcher.m @@ -35,12 +35,21 @@ if ((self = [super init])) { _manager = SDWebImageManager.new; - _manager.imageDownloader.maxConcurrentDownloads = 3; _options = SDWebImageLowPriority; + self.maxConcurrentDownloads = 3; } return self; } +- (void)setMaxConcurrentDownloads:(NSUInteger)maxConcurrentDownloads +{ + self.manager.imageDownloader.maxConcurrentDownloads = maxConcurrentDownloads; +} + +- (NSUInteger)maxConcurrentDownloads +{ + return self.manager.imageDownloader.maxConcurrentDownloads; +} - (void)startPrefetchingAtIndex:(NSUInteger)index { @@ -88,7 +97,7 @@ // Starts prefetching from the very first image on the list with the max allowed concurrency NSUInteger listCount = self.prefetchURLs.count; - for (NSUInteger i = 0; i < self.manager.imageDownloader.maxConcurrentDownloads && self.requestedCount < listCount; i++) + for (NSUInteger i = 0; i < self.maxConcurrentDownloads && self.requestedCount < listCount; i++) { [self startPrefetchingAtIndex:i]; }