From ccf5541a7d77b0318674bde503e4c95d42b61213 Mon Sep 17 00:00:00 2001 From: zhongwuzw Date: Mon, 7 Jan 2019 22:59:46 +0800 Subject: [PATCH] Fix memory cost override for SDAnimatedImage --- SDWebImage/SDAnimatedImage.m | 6 +----- SDWebImage/UIImage+MemoryCacheCost.h | 4 ++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/SDWebImage/SDAnimatedImage.m b/SDWebImage/SDAnimatedImage.m index 81148d08..6b779289 100644 --- a/SDWebImage/SDAnimatedImage.m +++ b/SDWebImage/SDAnimatedImage.m @@ -429,13 +429,9 @@ static NSArray *SDBundlePreferredScales() { @end -@interface SDAnimatedImage (MemoryCacheCost) - -@end - @implementation SDAnimatedImage (MemoryCacheCost) -- (NSUInteger)sd_imageMemoryCost { +- (NSUInteger)sd_memoryCost { NSNumber *value = objc_getAssociatedObject(self, @selector(sd_memoryCost)); if (value != nil) { return value.unsignedIntegerValue; diff --git a/SDWebImage/UIImage+MemoryCacheCost.h b/SDWebImage/UIImage+MemoryCacheCost.h index ba63928e..262c9964 100644 --- a/SDWebImage/UIImage+MemoryCacheCost.h +++ b/SDWebImage/UIImage+MemoryCacheCost.h @@ -16,8 +16,8 @@ For `UIImage`, this method return the single frame bytes size when `image.images` is nil for static image. Retuen full frame bytes size when `image.images` is not nil for animated image. For `NSImage`, this method return the single frame bytes size because `NSImage` does not store all frames in memory. - @note Note that because of the limitations of categories this property can get out of sync if you create another instance with CGImage or other methods. - @note For custom animated class conforms to `SDAnimatedImage`, you can override this getter method in your subclass to return a more proper value instead, which representing the current frames' total bytes. + @note Note that because of the limitations of category this property can get out of sync if you create another instance with CGImage or other methods. + @note For custom animated class conforms to `SDAnimatedImage`, you can override this getter method in your subclass to return a more proper value instead, which representing the current frame's total bytes. */ @property (assign, nonatomic) NSUInteger sd_memoryCost;