Fix memory cost override for SDAnimatedImage

This commit is contained in:
zhongwuzw 2019-01-07 22:59:46 +08:00
parent 6542eb36f7
commit ccf5541a7d
2 changed files with 3 additions and 7 deletions

View File

@ -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;

View File

@ -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;