Adds -[SDWebImageManager saveImageToCache:forURL:] method
Showing
2 changed files
with
17 additions
and
0 deletions
@@ -188,6 +188,16 @@ SDWebImageManager *manager = [SDWebImageManager sharedManager]; | @@ -188,6 +188,16 @@ SDWebImageManager *manager = [SDWebImageManager sharedManager]; | ||
188 | completed:(SDWebImageCompletedWithFinishedBlock)completedBlock; | 188 | completed:(SDWebImageCompletedWithFinishedBlock)completedBlock; |
189 | 189 | ||
190 | /** | 190 | /** |
191 | + * Saves image to cache for given URL | ||
192 | + * | ||
193 | + * @param image The image to cache | ||
194 | + * @param url The URL to the image | ||
195 | + * | ||
196 | + */ | ||
197 | + | ||
198 | +- (void)saveImageToCache:(UIImage *)image forURL:(NSURL *)url; | ||
199 | + | ||
200 | +/** | ||
191 | * Cancel all current opreations | 201 | * Cancel all current opreations |
192 | */ | 202 | */ |
193 | - (void)cancelAll; | 203 | - (void)cancelAll; |
@@ -215,6 +215,13 @@ | @@ -215,6 +215,13 @@ | ||
215 | return operation; | 215 | return operation; |
216 | } | 216 | } |
217 | 217 | ||
218 | +- (void)saveImageToCache:(UIImage *)image forURL:(NSURL *)url { | ||
219 | + if (image && url) { | ||
220 | + NSString *key = [self cacheKeyForURL:url]; | ||
221 | + [self.imageCache storeImage:image forKey:key toDisk:YES]; | ||
222 | + } | ||
223 | +} | ||
224 | + | ||
218 | - (void)cancelAll { | 225 | - (void)cancelAll { |
219 | @synchronized (self.runningOperations) { | 226 | @synchronized (self.runningOperations) { |
220 | [self.runningOperations makeObjectsPerformSelector:@selector(cancel)]; | 227 | [self.runningOperations makeObjectsPerformSelector:@selector(cancel)]; |
-
Please register or login to post a comment