File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 145
145
*/
146
146
- (void )sd_setImageWithURL : (NSURL *)url placeholderImage : (UIImage *)placeholder options : (SDWebImageOptions)options progress : (SDWebImageDownloaderProgressBlock)progressBlock completed : (SDWebImageCompletionBlock)completedBlock ;
147
147
148
+ /* *
149
+ * Set the imageView `image` with an `url` and a optionaly placeholder image.
150
+ *
151
+ * The download is asynchronous and cached.
152
+ *
153
+ * @param url The url for the image.
154
+ * @param placeholder The image to be set initially, until the image request finishes.
155
+ * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values.
156
+ * @param progressBlock A block called while image is downloading
157
+ * @param completedBlock A block called when operation has been completed. This block has no return value
158
+ * and takes the requested UIImage as first parameter. In case of error the image parameter
159
+ * is nil and the second parameter may contain an NSError. The third parameter is a Boolean
160
+ * indicating if the image was retrived from the local cache of from the network.
161
+ * The forth parameter is the original image url.
162
+ */
163
+ - (void )sd_setImageWithPreviousCachedImageWithURL : (NSURL *)url andPlaceholderImage : (UIImage *)placeholder options : (SDWebImageOptions)options progress : (SDWebImageDownloaderProgressBlock)progressBlock completed : (SDWebImageCompletionBlock)completedBlock ;
164
+
148
165
/* *
149
166
* Download an array of images and starts them in an animation loop
150
167
*
Original file line number Diff line number Diff line change @@ -77,6 +77,13 @@ - (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder
77
77
}
78
78
}
79
79
80
+ - (void )sd_setImageWithPreviousCachedImageWithURL : (NSURL *)url andPlaceholderImage : (UIImage *)placeholder options : (SDWebImageOptions)options progress : (SDWebImageDownloaderProgressBlock)progressBlock completed : (SDWebImageCompletionBlock)completedBlock {
81
+ NSString *key = [[SDWebImageManager sharedManager ] cacheKeyForURL: url];
82
+ UIImage *lastPreviousCachedImage = [[SDImageCache sharedImageCache ] imageFromDiskCacheForKey: key];
83
+
84
+ [self sd_setImageWithURL: url placeholderImage: lastPreviousCachedImage ?: placeholder options: options progress: progressBlock completed: completedBlock];
85
+ }
86
+
80
87
- (NSURL *)sd_imageURL {
81
88
return objc_getAssociatedObject (self, &imageURLKey);
82
89
}
You can’t perform that action at this time.
0 commit comments