From ed7df926eaa266a67817bfea63752373d3791730 Mon Sep 17 00:00:00 2001 From: Simon Burbidge Date: Mon, 21 Mar 2016 13:16:05 +0800 Subject: [PATCH] Added "cancelAllDownloads" method to SDWebImageDownloader. --- SDWebImage/SDWebImageDownloader.h | 5 +++++ SDWebImage/SDWebImageDownloader.m | 4 ++++ 2 files changed, 9 insertions(+) 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