Fix SDWebImagePrefetcher maxConcurrentDownloads property

This commit is contained in:
Olivier Poitrey 2012-11-20 14:49:27 +01:00
parent 44c6224763
commit 10c44577f6
1 changed files with 11 additions and 2 deletions

View File

@ -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];
}