Merge pull request #714 from derpoliuk/master
Saves image to cache without downloading it.
This commit is contained in:
commit
b29850b61b
|
@ -193,6 +193,16 @@ SDWebImageManager *manager = [SDWebImageManager sharedManager];
|
|||
progress:(SDWebImageDownloaderProgressBlock)progressBlock
|
||||
completed:(SDWebImageCompletedWithFinishedBlock)completedBlock;
|
||||
|
||||
/**
|
||||
* Saves image to cache for given URL
|
||||
*
|
||||
* @param image The image to cache
|
||||
* @param url The URL to the image
|
||||
*
|
||||
*/
|
||||
|
||||
- (void)saveImageToCache:(UIImage *)image forURL:(NSURL *)url;
|
||||
|
||||
/**
|
||||
* Cancel all current opreations
|
||||
*/
|
||||
|
|
|
@ -215,6 +215,13 @@
|
|||
return operation;
|
||||
}
|
||||
|
||||
- (void)saveImageToCache:(UIImage *)image forURL:(NSURL *)url {
|
||||
if (image && url) {
|
||||
NSString *key = [self cacheKeyForURL:url];
|
||||
[self.imageCache storeImage:image forKey:key toDisk:YES];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)cancelAll {
|
||||
@synchronized (self.runningOperations) {
|
||||
[self.runningOperations makeObjectsPerformSelector:@selector(cancel)];
|
||||
|
|
Loading…
Reference in New Issue