Allows SDWebImagePrefetcher options to be set set. Defaults to SDWebImageLowPriority.

This commit is contained in:
Jeff Cole 2012-05-11 18:44:37 -04:00
parent 102d7bd484
commit 35b6553eac
2 changed files with 8 additions and 1 deletions

View File

@ -26,6 +26,12 @@
*/ */
@property (nonatomic, assign) NSUInteger maxConcurrentDownloads; @property (nonatomic, assign) NSUInteger maxConcurrentDownloads;
/**
* SDWebImageOptions for prefetcher. Defaults to SDWebImageLowPriority.
*/
@property (nonatomic, assign) SDWebImageOptions options;
/** /**
* Return the global image prefetcher instance. * Return the global image prefetcher instance.
*/ */

View File

@ -26,6 +26,7 @@ static SDWebImagePrefetcher *instance;
{ {
instance = [[SDWebImagePrefetcher alloc] init]; instance = [[SDWebImagePrefetcher alloc] init];
instance.maxConcurrentDownloads = 3; instance.maxConcurrentDownloads = 3;
instance.options = (SDWebImageLowPriority);
} }
return instance; return instance;
@ -35,7 +36,7 @@ static SDWebImagePrefetcher *instance;
{ {
if (index >= [self.prefetchURLs count]) return; if (index >= [self.prefetchURLs count]) return;
_requestedCount++; _requestedCount++;
[imageManager downloadWithURL:[self.prefetchURLs objectAtIndex:index] delegate:self options:SDWebImageLowPriority]; [imageManager downloadWithURL:[self.prefetchURLs objectAtIndex:index] delegate:self options:self.options];
} }
- (void)reportStatus - (void)reportStatus