Add cancelAll method (fix #168)
This commit is contained in:
parent
55fd4a1d77
commit
8963f996e9
|
@ -153,4 +153,9 @@ typedef NSString *(^CacheKeyFilter)(NSURL *url);
|
|||
*/
|
||||
- (void)cancelForDelegate:(id<SDWebImageManagerDelegate>)delegate;
|
||||
|
||||
/**
|
||||
* Cancel all current opreations
|
||||
*/
|
||||
- (void)cancelAll;
|
||||
|
||||
@end
|
||||
|
|
|
@ -209,6 +209,21 @@ static SDWebImageManager *instance;
|
|||
}
|
||||
}
|
||||
|
||||
- (void)cancelAll
|
||||
{
|
||||
for (SDWebImageDownloader *downloader in downloaders)
|
||||
{
|
||||
[downloader cancel];
|
||||
}
|
||||
[cacheDelegates removeAllObjects];
|
||||
[cacheURLs removeAllObjects];
|
||||
|
||||
[downloadInfo removeAllObjects];
|
||||
[downloadDelegates removeAllObjects];
|
||||
[downloaders removeAllObjects];
|
||||
[downloaderForURL removeAllObjects];
|
||||
}
|
||||
|
||||
#pragma mark SDImageCacheDelegate
|
||||
|
||||
- (NSUInteger)indexOfDelegate:(id<SDWebImageManagerDelegate>)delegate waitingForURL:(NSURL *)url
|
||||
|
|
Loading…
Reference in New Issue