diff --git a/SDWebImage/SDImageCache.h b/SDWebImage/SDImageCache.h index c6b63f9b..7a76ca19 100644 --- a/SDWebImage/SDImageCache.h +++ b/SDWebImage/SDImageCache.h @@ -35,7 +35,7 @@ typedef enum SDImageCacheType SDImageCacheType; /** * The maximum "total cost" of the in-memory image cache. The cost function is the number of pixels held in memory. */ -@property (assign, nonatomic) NSInteger maxMemoryCost; +@property (assign, nonatomic) NSUInteger maxMemoryCost; /** * The maximum length of time to keep an image in the cache, in seconds diff --git a/SDWebImage/SDImageCache.m b/SDWebImage/SDImageCache.m index c8748c3f..8ffed7b1 100644 --- a/SDWebImage/SDImageCache.m +++ b/SDWebImage/SDImageCache.m @@ -338,11 +338,16 @@ static const NSInteger kDefaultCacheMaxCacheAge = 60 * 60 * 24 * 7; // 1 week } } -- (void)setMaxMemoryCost:(NSInteger)maxMemoryCost +- (void)setMaxMemoryCost:(NSUInteger)maxMemoryCost { self.memCache.totalCostLimit = maxMemoryCost; } +- (NSUInteger)maxMemoryCost +{ + return self.memCache.totalCostLimit; +} + - (void)clearMemory { [self.memCache removeAllObjects];