diff --git a/SDWebImage/MKAnnotationView+WebCache.h b/SDWebImage/MKAnnotationView+WebCache.h index 2f9a8f7..5bec611 100644 --- a/SDWebImage/MKAnnotationView+WebCache.h +++ b/SDWebImage/MKAnnotationView+WebCache.h @@ -20,7 +20,7 @@ * Note that because of the limitations of categories this property can get out of sync * if you use sd_setImage: directly. */ -- (NSURL *)imageURL; +- (NSURL *)sd_imageURL; /** * Set the imageView `image` with an `url`. @@ -102,13 +102,15 @@ /** * Cancel the current download */ -- (void)cancelCurrentImageLoad; +- (void)sd_cancelCurrentImageLoad; @end @interface MKAnnotationView (WebCacheDeprecated) +- (NSURL *)imageURL __deprecated_msg("Use `sd_imageURL`"); + - (void)setImageWithURL:(NSURL *)url __deprecated_msg("Method deprecated. Use `sd_setImageWithURL:`"); - (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder __deprecated_msg("Method deprecated. Use `sd_setImageWithURL:placeholderImage:`"); - (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options __deprecated_msg("Method deprecated. Use `sd_setImageWithURL:placeholderImage:options:`"); @@ -117,4 +119,6 @@ - (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletedBlock)completedBlock __deprecated_msg("Method deprecated. Use `sd_setImageWithURL:placeholderImage:completed:`"); - (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletedBlock)completedBlock __deprecated_msg("Method deprecated. Use `sd_setImageWithURL:placeholderImage:options:completed:`"); +- (void)cancelCurrentImageLoad __deprecated_msg("Use `sd_cancelCurrentImageLoad`"); + @end diff --git a/SDWebImage/MKAnnotationView+WebCache.m b/SDWebImage/MKAnnotationView+WebCache.m index 904ba0a..240f5af 100644 --- a/SDWebImage/MKAnnotationView+WebCache.m +++ b/SDWebImage/MKAnnotationView+WebCache.m @@ -14,7 +14,7 @@ static char imageURLKey; @implementation MKAnnotationView (WebCache) -- (NSURL *)imageURL { +- (NSURL *)sd_imageURL { return objc_getAssociatedObject(self, &imageURLKey); } @@ -59,7 +59,7 @@ static char imageURLKey; } }); }]; - [self setImageLoadOperation:operation forKey:@"MKAnnotationViewImage"]; + [self sd_setImageLoadOperation:operation forKey:@"MKAnnotationViewImage"]; } else { dispatch_main_async_safe(^{ NSError *error = [NSError errorWithDomain:@"SDWebImageErrorDomain" code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}]; @@ -70,8 +70,8 @@ static char imageURLKey; } } -- (void)cancelCurrentImageLoad { - [self cancelImageLoadOperationWithKey:@"MKAnnotationViewImage"]; +- (void)sd_cancelCurrentImageLoad { + [self sd_cancelImageLoadOperationWithKey:@"MKAnnotationViewImage"]; } @end @@ -79,6 +79,10 @@ static char imageURLKey; @implementation MKAnnotationView (WebCacheDeprecated) +- (NSURL *)imageURL { + return [self sd_imageURL]; +} + - (void)setImageWithURL:(NSURL *)url { [self sd_setImageWithURL:url placeholderImage:nil options:0 completed:nil]; } @@ -115,4 +119,8 @@ static char imageURLKey; }]; } +- (void)cancelCurrentImageLoad { + [self sd_cancelCurrentImageLoad]; +} + @end diff --git a/SDWebImage/NSData+ImageContentType.h b/SDWebImage/NSData+ImageContentType.h index 9ad2dfe..69c76dc 100644 --- a/SDWebImage/NSData+ImageContentType.h +++ b/SDWebImage/NSData+ImageContentType.h @@ -14,6 +14,13 @@ * * @return the content type as string (i.e. image/jpeg, image/gif) */ -+ (NSString *)contentTypeForImageData:(NSData *)data; ++ (NSString *)sd_contentTypeForImageData:(NSData *)data; + +@end + + +@interface NSData (ImageContentTypeDeprecated) + ++ (NSString *)contentTypeForImageData:(NSData *)data __deprecated_msg("Use `sd_contentTypeForImageData:`"); @end diff --git a/SDWebImage/NSData+ImageContentType.m b/SDWebImage/NSData+ImageContentType.m index 6fb352d..0941cfa 100644 --- a/SDWebImage/NSData+ImageContentType.m +++ b/SDWebImage/NSData+ImageContentType.m @@ -8,7 +8,7 @@ @implementation NSData (ImageContentType) -+ (NSString *)contentTypeForImageData:(NSData *)data { ++ (NSString *)sd_contentTypeForImageData:(NSData *)data { uint8_t c; [data getBytes:&c length:1]; switch (c) { @@ -38,3 +38,12 @@ } @end + + +@implementation NSData (ImageContentTypeDeprecated) + ++ (NSString *)contentTypeForImageData:(NSData *)data { + return [self sd_contentTypeForImageData:data]; +} + +@end diff --git a/SDWebImage/UIButton+WebCache.h b/SDWebImage/UIButton+WebCache.h index 6830d4f..7a6e867 100644 --- a/SDWebImage/UIButton+WebCache.h +++ b/SDWebImage/UIButton+WebCache.h @@ -17,14 +17,14 @@ /** * Get the current image URL. */ -- (NSURL *)currentImageURL; +- (NSURL *)sd_currentImageURL; /** * Get the image URL for a control state. * * @param state Which state you want to know the URL for. The values are described in UIControlState. */ -- (NSURL *)imageURLForState:(UIControlState)state; +- (NSURL *)sd_imageURLForState:(UIControlState)state; /** * Set the imageView `image` with an `url`. @@ -192,18 +192,21 @@ /** * Cancel the current image download */ -- (void)cancelImageLoadForState:(UIControlState)state; +- (void)sd_cancelImageLoadForState:(UIControlState)state; /** * Cancel the current backgroundImage download */ -- (void)cancelBackgroundImageLoadForState:(UIControlState)state; +- (void)sd_cancelBackgroundImageLoadForState:(UIControlState)state; @end @interface UIButton (WebCacheDeprecated) +- (NSURL *)currentImageURL __deprecated_msg("Use `sd_currentImageURL`"); +- (NSURL *)imageURLForState:(UIControlState)state __deprecated_msg("Use `sd_imageURLForState:`"); + - (void)setImageWithURL:(NSURL *)url forState:(UIControlState)state __deprecated_msg("Method deprecated. Use `sd_setImageWithURL:forState:`"); - (void)setImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder __deprecated_msg("Method deprecated. Use `sd_setImageWithURL:forState:placeholderImage:`"); - (void)setImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options __deprecated_msg("Method deprecated. Use `sd_setImageWithURL:forState:placeholderImage:options:`"); @@ -220,6 +223,7 @@ - (void)setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletedBlock)completedBlock __deprecated_msg("Method deprecated. Use `sd_setBackgroundImageWithURL:forState:placeholderImage:completed:`"); - (void)setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletedBlock)completedBlock __deprecated_msg("Method deprecated. Use `sd_setBackgroundImageWithURL:forState:placeholderImage:options:completed:`"); -- (void)cancelCurrentImageLoad __deprecated_msg("Use `cancelImageLoadForState:`"); +- (void)cancelCurrentImageLoad __deprecated_msg("Use `sd_cancelImageLoadForState:`"); +- (void)cancelBackgroundImageLoadForState:(UIControlState)state __deprecated_msg("Use `sd_cancelBackgroundImageLoadForState:`"); @end diff --git a/SDWebImage/UIButton+WebCache.m b/SDWebImage/UIButton+WebCache.m index b4b3984..8e076ae 100644 --- a/SDWebImage/UIButton+WebCache.m +++ b/SDWebImage/UIButton+WebCache.m @@ -14,7 +14,7 @@ static char imageURLStorageKey; @implementation UIButton (WebCache) -- (NSURL *)currentImageURL { +- (NSURL *)sd_currentImageURL { NSURL *url = self.imageURLStorage[@(self.state)]; if (!url) { @@ -24,7 +24,7 @@ static char imageURLStorageKey; return url; } -- (NSURL *)imageURLForState:(UIControlState)state { +- (NSURL *)sd_imageURLForState:(UIControlState)state { return self.imageURLStorage[@(state)]; } @@ -51,7 +51,7 @@ static char imageURLStorageKey; - (void)sd_setImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletionBlock)completedBlock { [self setImage:placeholder forState:state]; - [self cancelImageLoadForState:state]; + [self sd_cancelImageLoadForState:state]; if (!url) { [self.imageURLStorage removeObjectForKey:@(state)]; @@ -82,7 +82,7 @@ static char imageURLStorageKey; } }); }]; - [self setImageLoadOperation:operation forState:state]; + [self sd_setImageLoadOperation:operation forState:state]; } - (void)sd_setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state { @@ -106,7 +106,7 @@ static char imageURLStorageKey; } - (void)sd_setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletionBlock)completedBlock { - [self cancelImageLoadForState:state]; + [self sd_cancelImageLoadForState:state]; [self setBackgroundImage:placeholder forState:state]; @@ -125,7 +125,7 @@ static char imageURLStorageKey; } }); }]; - [self setBackgroundImageLoadOperation:operation forState:state]; + [self sd_setBackgroundImageLoadOperation:operation forState:state]; } else { dispatch_main_async_safe(^{ NSError *error = [NSError errorWithDomain:@"SDWebImageErrorDomain" code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}]; @@ -136,20 +136,20 @@ static char imageURLStorageKey; } } -- (void)setImageLoadOperation:(id)operation forState:(UIControlState)state { - [self setImageLoadOperation:operation forKey:[NSString stringWithFormat:@"UIButtonImageOperation%@", @(state)]]; +- (void)sd_setImageLoadOperation:(id)operation forState:(UIControlState)state { + [self sd_setImageLoadOperation:operation forKey:[NSString stringWithFormat:@"UIButtonImageOperation%@", @(state)]]; } -- (void)cancelImageLoadForState:(UIControlState)state { - [self cancelImageLoadOperationWithKey:[NSString stringWithFormat:@"UIButtonImageOperation%@", @(state)]]; +- (void)sd_cancelImageLoadForState:(UIControlState)state { + [self sd_cancelImageLoadOperationWithKey:[NSString stringWithFormat:@"UIButtonImageOperation%@", @(state)]]; } -- (void)setBackgroundImageLoadOperation:(id)operation forState:(UIControlState)state { - [self setImageLoadOperation:operation forKey:[NSString stringWithFormat:@"UIButtonBackgroundImageOperation%@", @(state)]]; +- (void)sd_setBackgroundImageLoadOperation:(id)operation forState:(UIControlState)state { + [self sd_setImageLoadOperation:operation forKey:[NSString stringWithFormat:@"UIButtonBackgroundImageOperation%@", @(state)]]; } -- (void)cancelBackgroundImageLoadForState:(UIControlState)state { - [self cancelImageLoadOperationWithKey:[NSString stringWithFormat:@"UIButtonBackgroundImageOperation%@", @(state)]]; +- (void)sd_cancelBackgroundImageLoadForState:(UIControlState)state { + [self sd_cancelImageLoadOperationWithKey:[NSString stringWithFormat:@"UIButtonBackgroundImageOperation%@", @(state)]]; } - (NSMutableDictionary *)imageURLStorage { @@ -168,6 +168,14 @@ static char imageURLStorageKey; @implementation UIButton (WebCacheDeprecated) +- (NSURL *)currentImageURL { + return [self sd_currentImageURL]; +} + +- (NSURL *)imageURLForState:(UIControlState)state { + return [self sd_imageURLForState:state]; +} + - (void)setImageWithURL:(NSURL *)url forState:(UIControlState)state { [self sd_setImageWithURL:url forState:state placeholderImage:nil options:0 completed:nil]; } @@ -242,7 +250,11 @@ static char imageURLStorageKey; - (void)cancelCurrentImageLoad { // in a backwards compatible manner, cancel for current state - [self cancelImageLoadOperationWithKey:[NSString stringWithFormat:@"UIButtonImageOperation%@", @(self.state)]]; + [self sd_cancelImageLoadForState:self.state]; +} + +- (void)cancelBackgroundImageLoadForState:(UIControlState)state { + [self sd_cancelBackgroundImageLoadForState:state]; } @end diff --git a/SDWebImage/UIImage+GIF.m b/SDWebImage/UIImage+GIF.m index f48d179..a703637 100755 --- a/SDWebImage/UIImage+GIF.m +++ b/SDWebImage/UIImage+GIF.m @@ -33,7 +33,7 @@ for (size_t i = 0; i < count; i++) { CGImageRef image = CGImageSourceCreateImageAtIndex(source, i, NULL); - duration += [self frameDurationAtIndex:i source:source]; + duration += [self sd_frameDurationAtIndex:i source:source]; [images addObject:[UIImage imageWithCGImage:image scale:[UIScreen mainScreen].scale orientation:UIImageOrientationUp]]; @@ -52,7 +52,7 @@ return animatedImage; } -+ (float)frameDurationAtIndex:(NSUInteger)index source:(CGImageSourceRef)source { ++ (float)sd_frameDurationAtIndex:(NSUInteger)index source:(CGImageSourceRef)source { float frameDuration = 0.1f; CFDictionaryRef cfFrameProperties = CGImageSourceCopyPropertiesAtIndex(source, index, nil); NSDictionary *frameProperties = (__bridge NSDictionary *)cfFrameProperties; diff --git a/SDWebImage/UIImage+MultiFormat.m b/SDWebImage/UIImage+MultiFormat.m index 90f5562..a0b138c 100644 --- a/SDWebImage/UIImage+MultiFormat.m +++ b/SDWebImage/UIImage+MultiFormat.m @@ -19,7 +19,7 @@ + (UIImage *)sd_imageWithData:(NSData *)data { UIImage *image; - NSString *imageContentType = [NSData contentTypeForImageData:data]; + NSString *imageContentType = [NSData sd_contentTypeForImageData:data]; if ([imageContentType isEqualToString:@"image/gif"]) { image = [UIImage sd_animatedGIFWithData:data]; } diff --git a/SDWebImage/UIImageView+HighlightedWebCache.h b/SDWebImage/UIImageView+HighlightedWebCache.h index ee18d75..6b00366 100644 --- a/SDWebImage/UIImageView+HighlightedWebCache.h +++ b/SDWebImage/UIImageView+HighlightedWebCache.h @@ -82,7 +82,7 @@ /** * Cancel the current download */ -- (void)cancelCurrentHighlightedImageLoad; +- (void)sd_cancelCurrentHighlightedImageLoad; @end @@ -95,4 +95,6 @@ - (void)setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)options completed:(SDWebImageCompletedBlock)completedBlock __deprecated_msg("Method deprecated. Use `sd_setHighlightedImageWithURL:options:completed:`"); - (void)setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletedBlock)completedBlock __deprecated_msg("Method deprecated. Use `sd_setHighlightedImageWithURL:options:progress:completed:`"); +- (void)cancelCurrentHighlightedImageLoad __deprecated_msg("Use `sd_cancelCurrentHighlightedImageLoad`"); + @end diff --git a/SDWebImage/UIImageView+HighlightedWebCache.m b/SDWebImage/UIImageView+HighlightedWebCache.m index c8f3024..ae73610 100644 --- a/SDWebImage/UIImageView+HighlightedWebCache.m +++ b/SDWebImage/UIImageView+HighlightedWebCache.m @@ -30,7 +30,7 @@ } - (void)sd_setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletionBlock)completedBlock { - [self cancelCurrentHighlightedImageLoad]; + [self sd_cancelCurrentHighlightedImageLoad]; if (url) { __weak UIImageView *wself = self; @@ -48,7 +48,7 @@ } }); }]; - [self setImageLoadOperation:operation forKey:UIImageViewHighlightedWebCacheOperationKey]; + [self sd_setImageLoadOperation:operation forKey:UIImageViewHighlightedWebCacheOperationKey]; } else { dispatch_main_async_safe(^{ NSError *error = [NSError errorWithDomain:@"SDWebImageErrorDomain" code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}]; @@ -59,8 +59,8 @@ } } -- (void)cancelCurrentHighlightedImageLoad { - [self cancelImageLoadOperationWithKey:UIImageViewHighlightedWebCacheOperationKey]; +- (void)sd_cancelCurrentHighlightedImageLoad { + [self sd_cancelImageLoadOperationWithKey:UIImageViewHighlightedWebCacheOperationKey]; } @end @@ -100,4 +100,8 @@ }]; } +- (void)cancelCurrentHighlightedImageLoad { + [self sd_cancelCurrentHighlightedImageLoad]; +} + @end diff --git a/SDWebImage/UIImageView+WebCache.h b/SDWebImage/UIImageView+WebCache.h index ba6e264..dc08219 100644 --- a/SDWebImage/UIImageView+WebCache.h +++ b/SDWebImage/UIImageView+WebCache.h @@ -50,7 +50,7 @@ * Note that because of the limitations of categories this property can get out of sync * if you use sd_setImage: directly. */ -- (NSURL *)imageURL; +- (NSURL *)sd_imageURL; /** * Set the imageView `image` with an `url`. @@ -148,22 +148,24 @@ /** * Download an array of images and starts them in an animation loop * - *@param arrayOfURLs An array of NSURL + * @param arrayOfURLs An array of NSURL */ -- (void)setAnimationImagesWithURLs:(NSArray *)arrayOfURLs; +- (void)sd_setAnimationImagesWithURLs:(NSArray *)arrayOfURLs; /** * Cancel the current download */ -- (void)cancelCurrentImageLoad; +- (void)sd_cancelCurrentImageLoad; -- (void)cancelCurrentAnimationImagesLoad; +- (void)sd_cancelCurrentAnimationImagesLoad; @end @interface UIImageView (WebCacheDeprecated) +- (NSURL *)imageURL __deprecated_msg("Use `sd_imageURL`"); + - (void)setImageWithURL:(NSURL *)url __deprecated_msg("Method deprecated. Use `sd_setImageWithURL:`"); - (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder __deprecated_msg("Method deprecated. Use `sd_setImageWithURL:placeholderImage:`"); - (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options __deprecated_msg("Method deprecated. Use `sd_setImageWithURL:placeholderImage:options`"); @@ -173,6 +175,10 @@ - (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletedBlock)completedBlock __deprecated_msg("Method deprecated. Use `sd_setImageWithURL:placeholderImage:options:completed:`"); - (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletedBlock)completedBlock __deprecated_msg("Method deprecated. Use `sd_setImageWithURL:placeholderImage:options:progress:completed:`"); -- (void)cancelCurrentArrayLoad __deprecated_msg("Use `cancelCurrentAnimationImagesLoad`"); +- (void)setAnimationImagesWithURLs:(NSArray *)arrayOfURLs __deprecated_msg("Use `sd_setAnimationImagesWithURLs:`"); + +- (void)cancelCurrentArrayLoad __deprecated_msg("Use `sd_cancelCurrentAnimationImagesLoad`"); + +- (void)cancelCurrentImageLoad __deprecated_msg("Use `cancelCurrentImageLoad`"); @end diff --git a/SDWebImage/UIImageView+WebCache.m b/SDWebImage/UIImageView+WebCache.m index 65112bf..b921a32 100644 --- a/SDWebImage/UIImageView+WebCache.m +++ b/SDWebImage/UIImageView+WebCache.m @@ -39,7 +39,7 @@ static char imageURLKey; } - (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletionBlock)completedBlock { - [self cancelCurrentImageLoad]; + [self sd_cancelCurrentImageLoad]; objc_setAssociatedObject(self, &imageURLKey, url, OBJC_ASSOCIATION_RETAIN_NONATOMIC); if (!(options & SDWebImageDelayPlaceholder)) { @@ -66,7 +66,7 @@ static char imageURLKey; } }); }]; - [self setImageLoadOperation:operation forKey:@"UIImageViewImageLoad"]; + [self sd_setImageLoadOperation:operation forKey:@"UIImageViewImageLoad"]; } else { dispatch_main_async_safe(^{ NSError *error = [NSError errorWithDomain:@"SDWebImageErrorDomain" code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}]; @@ -77,12 +77,12 @@ static char imageURLKey; } } -- (NSURL *)imageURL { +- (NSURL *)sd_imageURL { return objc_getAssociatedObject(self, &imageURLKey); } -- (void)setAnimationImagesWithURLs:(NSArray *)arrayOfURLs { - [self cancelCurrentAnimationImagesLoad]; +- (void)sd_setAnimationImagesWithURLs:(NSArray *)arrayOfURLs { + [self sd_cancelCurrentAnimationImagesLoad]; __weak UIImageView *wself = self; NSMutableArray *operationsArray = [[NSMutableArray alloc] init]; @@ -109,15 +109,15 @@ static char imageURLKey; [operationsArray addObject:operation]; } - [self setImageLoadOperation:[NSArray arrayWithArray:operationsArray] forKey:@"UIImageViewAnimationImages"]; + [self sd_setImageLoadOperation:[NSArray arrayWithArray:operationsArray] forKey:@"UIImageViewAnimationImages"]; } -- (void)cancelCurrentImageLoad { - [self cancelImageLoadOperationWithKey:@"UIImageViewImageLoad"]; +- (void)sd_cancelCurrentImageLoad { + [self sd_cancelImageLoadOperationWithKey:@"UIImageViewImageLoad"]; } -- (void)cancelCurrentAnimationImagesLoad { - [self cancelImageLoadOperationWithKey:@"UIImageViewAnimationImages"]; +- (void)sd_cancelCurrentAnimationImagesLoad { + [self sd_cancelImageLoadOperationWithKey:@"UIImageViewAnimationImages"]; } @end @@ -125,6 +125,10 @@ static char imageURLKey; @implementation UIImageView (WebCacheDeprecated) +- (NSURL *)imageURL { + return [self sd_imageURL]; +} + - (void)setImageWithURL:(NSURL *)url { [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:nil]; } @@ -151,7 +155,6 @@ static char imageURLKey; completedBlock(image, error, cacheType); } }]; - } - (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletedBlock)completedBlock { @@ -160,7 +163,6 @@ static char imageURLKey; completedBlock(image, error, cacheType); } }]; - } - (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletedBlock)completedBlock { @@ -169,11 +171,18 @@ static char imageURLKey; completedBlock(image, error, cacheType); } }]; - } - (void)cancelCurrentArrayLoad { - [self cancelCurrentAnimationImagesLoad]; + [self sd_cancelCurrentAnimationImagesLoad]; +} + +- (void)cancelCurrentImageLoad { + [self sd_cancelCurrentImageLoad]; +} + +- (void)setAnimationImagesWithURLs:(NSArray *)arrayOfURLs { + [self sd_setAnimationImagesWithURLs:arrayOfURLs]; } @end diff --git a/SDWebImage/UIView+WebCacheOperation.h b/SDWebImage/UIView+WebCacheOperation.h index 45d6400..6719036 100644 --- a/SDWebImage/UIView+WebCacheOperation.h +++ b/SDWebImage/UIView+WebCacheOperation.h @@ -17,20 +17,20 @@ * @param operation the operation * @param key key for storing the operation */ -- (void)setImageLoadOperation:(id)operation forKey:(NSString *)key; +- (void)sd_setImageLoadOperation:(id)operation forKey:(NSString *)key; /** * Cancel all operations for the current UIView and key * * @param key key for identifying the operations */ -- (void)cancelImageLoadOperationWithKey:(NSString *)key; +- (void)sd_cancelImageLoadOperationWithKey:(NSString *)key; /** * Just remove the operations corresponding to the current UIView and key without cancelling them * * @param key key for identifying the operations */ -- (void)removeImageLoadOperationWithKey:(NSString *)key; +- (void)sd_removeImageLoadOperationWithKey:(NSString *)key; @end diff --git a/SDWebImage/UIView+WebCacheOperation.m b/SDWebImage/UIView+WebCacheOperation.m index 64e1ff3..9219478 100644 --- a/SDWebImage/UIView+WebCacheOperation.m +++ b/SDWebImage/UIView+WebCacheOperation.m @@ -23,13 +23,13 @@ static char loadOperationKey; return operations; } -- (void)setImageLoadOperation:(id)operation forKey:(NSString *)key { - [self cancelImageLoadOperationWithKey:key]; +- (void)sd_setImageLoadOperation:(id)operation forKey:(NSString *)key { + [self sd_cancelImageLoadOperationWithKey:key]; NSMutableDictionary *operationDictionary = [self operationDictionary]; [operationDictionary setObject:operation forKey:key]; } -- (void)cancelImageLoadOperationWithKey:(NSString *)key { +- (void)sd_cancelImageLoadOperationWithKey:(NSString *)key { // Cancel in progress downloader from queue NSMutableDictionary *operationDictionary = [self operationDictionary]; id operations = [operationDictionary objectForKey:key]; @@ -47,7 +47,7 @@ static char loadOperationKey; } } -- (void)removeImageLoadOperationWithKey:(NSString *)key { +- (void)sd_removeImageLoadOperationWithKey:(NSString *)key { NSMutableDictionary *operationDictionary = [self operationDictionary]; [operationDictionary removeObjectForKey:key]; }