Merge pull request #2577 from zhongwuzw/fix_memory_cost
Fix memory cost override for SDAnimatedImage
This commit is contained in:
commit
ac1dd066cb
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue