Authored by Bill Burgess

Moved the delay placeholder flag to SDWebImageOptions

... ... @@ -68,7 +68,13 @@ typedef NS_OPTIONS(NSUInteger, SDWebImageOptions) {
* the front of the queue and is loaded immediately instead of waiting for the current queue to be loaded (which
* could take a while).
*/
SDWebImageHighPriority = 1 << 8
SDWebImageHighPriority = 1 << 8,
/**
* By default, placeholder images are loaded while the image is loading. This flag will delay the loading
* of the placeholder image until after the image has finished loading.
*/
SDWebImageDelayPlaceholder = 1 << 9
};
typedef void(^SDWebImageCompletedBlock)(UIImage *image, NSError *error, SDImageCacheType cacheType);
... ...
... ... @@ -134,24 +134,6 @@
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletedBlock)completedBlock;
/**
* Set the imageView 'image' with an 'url', placeholder and custom options.
*
* The download is asynchronous and cached.
*
* @param url The url for the image.
* @param placeholder The image to be set initially, until the image request finishes.
* @param delayPlaceholder The value that determines if the placeholder is loaded while the image is fetched,
* or after the image fails to load.
* @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values.
* @param progressBlock A block called while image is downloading
* @param completedBlock A block called when operation has been completed. This block as no return value
* and takes the requested UIImage as first parameter. In case of error the image parameter
* is nil and the second parameter may contain an NSError. The third parameter is a Boolean
* indicating if the image was retrived from the local cache of from the network.
*/
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder delayPlaceholderLoad:(BOOL)delayPlaceholder options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletedBlock)completedBlock;
/**
* Download an array of images and starts them in an animation loop
*
*@param arrayOfURLs An array of NSURL
... ...
... ... @@ -39,13 +39,9 @@ static char operationArrayKey;
}
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletedBlock)completedBlock {
[self setImageWithURL:url placeholderImage:placeholder delayPlaceholderLoad:NO options:options progress:progressBlock completed:completedBlock];
}
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder delayPlaceholderLoad:(BOOL)delayPlaceholder options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletedBlock)completedBlock {
[self cancelCurrentImageLoad];
if (!delayPlaceholder) {
if (options != SDWebImageDelayPlaceholder) {
self.image = placeholder;
}
... ... @@ -59,7 +55,7 @@ static char operationArrayKey;
wself.image = image;
[wself setNeedsLayout];
} else {
if (delayPlaceholder) {
if (options == SDWebImageDelayPlaceholder) {
wself.image = placeholder;
[wself setNeedsLayout];
}
... ...