diff --git a/SDWebImage/SDWebImageDownloader.h b/SDWebImage/SDWebImageDownloader.h index b64fb130..be02ab6f 100644 --- a/SDWebImage/SDWebImageDownloader.h +++ b/SDWebImage/SDWebImageDownloader.h @@ -188,4 +188,9 @@ typedef NSDictionary *(^SDWebImageDownloaderHeadersFilterBlock)(NSURL *url, NSDi */ - (void)setSuspended:(BOOL)suspended; +/** + * Cancels all download operations in the queue + */ +- (void)cancelAllDownloads; + @end diff --git a/SDWebImage/SDWebImageDownloader.m b/SDWebImage/SDWebImageDownloader.m index 1fdcfc92..96aefa77 100644 --- a/SDWebImage/SDWebImageDownloader.m +++ b/SDWebImage/SDWebImageDownloader.m @@ -229,4 +229,8 @@ static NSString *const kCompletedCallbackKey = @"completed"; [self.downloadQueue setSuspended:suspended]; } +- (void)cancelAllDownloads { + [self.downloadQueue cancelAllOperations]; +} + @end