Add prefix to GIF support category's methods

This commit is contained in:
Olivier Poitrey 2013-04-29 12:47:37 +02:00
parent 65807f262e
commit 4137bce30d
7 changed files with 16 additions and 16 deletions

View File

@ -10,6 +10,6 @@
@interface NSData (GIF) @interface NSData (GIF)
- (BOOL)isGIF; - (BOOL)sd_isGIF;
@end @end

View File

@ -10,7 +10,7 @@
@implementation NSData (GIF) @implementation NSData (GIF)
- (BOOL)isGIF - (BOOL)sd_isGIF
{ {
BOOL isGIF = NO; BOOL isGIF = NO;

View File

@ -181,9 +181,9 @@ static const NSInteger kDefaultCacheMaxCacheAge = 60 * 60 * 24 * 7; // 1 week
NSData *data = [NSData dataWithContentsOfFile:path]; NSData *data = [NSData dataWithContentsOfFile:path];
if (data) if (data)
{ {
if ([data isGIF]) if ([data sd_isGIF])
{ {
UIImage *image = [UIImage animatedGIFWithData:data]; UIImage *image = [UIImage sd_animatedGIFWithData:data];
return [self scaledImageForKey:key image:image]; return [self scaledImageForKey:key image:image];
} }
else else

View File

@ -275,12 +275,12 @@
} }
else else
{ {
BOOL isImageGIF = [self.imageData isGIF]; BOOL isImageGIF = [self.imageData sd_isGIF];
UIImage *image; UIImage *image;
if (isImageGIF) if (isImageGIF)
{ {
image = [UIImage animatedGIFWithData:self.imageData]; image = [UIImage sd_animatedGIFWithData:self.imageData];
} }
else else
{ {

View File

@ -150,7 +150,7 @@
{ {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^
{ {
BOOL isImageGIF = [data isGIF]; BOOL isImageGIF = [data sd_isGIF];
UIImage *transformedImage = isImageGIF ? downloadedImage : [self.delegate imageManager:self transformDownloadedImage:downloadedImage withURL:url]; UIImage *transformedImage = isImageGIF ? downloadedImage : [self.delegate imageManager:self transformDownloadedImage:downloadedImage withURL:url];
dispatch_async(dispatch_get_main_queue(), ^ dispatch_async(dispatch_get_main_queue(), ^

View File

@ -11,9 +11,9 @@
@interface UIImage (GIF) @interface UIImage (GIF)
+ (UIImage *)animatedGIFNamed:(NSString *)name; + (UIImage *)sd_animatedGIFNamed:(NSString *)name;
+ (UIImage *)animatedGIFWithData:(NSData *)data; + (UIImage *)sd_animatedGIFWithData:(NSData *)data;
- (UIImage *)animatedImageByScalingAndCroppingToSize:(CGSize)size; - (UIImage *)sd_animatedImageByScalingAndCroppingToSize:(CGSize)size;
@end @end

View File

@ -11,7 +11,7 @@
@implementation UIImage (GIF) @implementation UIImage (GIF)
+ (UIImage *)animatedGIFWithData:(NSData *)data + (UIImage *)sd_animatedGIFWithData:(NSData *)data
{ {
if (!data) if (!data)
{ {
@ -47,7 +47,7 @@
return [UIImage animatedImageWithImages:images duration:duration]; return [UIImage animatedImageWithImages:images duration:duration];
} }
+ (UIImage *)animatedGIFNamed:(NSString *)name + (UIImage *)sd_animatedGIFNamed:(NSString *)name
{ {
CGFloat scale = [UIScreen mainScreen].scale; CGFloat scale = [UIScreen mainScreen].scale;
@ -59,7 +59,7 @@
if (data) if (data)
{ {
return [UIImage animatedGIFWithData:data]; return [UIImage sd_animatedGIFWithData:data];
} }
NSString *path = [[NSBundle mainBundle] pathForResource:name ofType:@"gif"]; NSString *path = [[NSBundle mainBundle] pathForResource:name ofType:@"gif"];
@ -68,7 +68,7 @@
if (data) if (data)
{ {
return [UIImage animatedGIFWithData:data]; return [UIImage sd_animatedGIFWithData:data];
} }
return [UIImage imageNamed:name]; return [UIImage imageNamed:name];
@ -81,14 +81,14 @@
if (data) if (data)
{ {
return [UIImage animatedGIFWithData:data]; return [UIImage sd_animatedGIFWithData:data];
} }
return [UIImage imageNamed:name]; return [UIImage imageNamed:name];
} }
} }
- (UIImage *)animatedImageByScalingAndCroppingToSize:(CGSize)size - (UIImage *)sd_animatedImageByScalingAndCroppingToSize:(CGSize)size
{ {
if (CGSizeEqualToSize(self.size, size) || CGSizeEqualToSize(size, CGSizeZero)) if (CGSizeEqualToSize(self.size, size) || CGSizeEqualToSize(size, CGSizeZero))
{ {