Rename `NSImage+WebCache` to `NSImage+Addtions`. Add helper methods, use property based API, which more suitable for Swift
This commit is contained in:
parent
6797ed8be6
commit
b6e108a5b1
|
@ -97,6 +97,11 @@
|
|||
321E60C71F38E91700405457 /* UIImage+ForceDecode.m in Sources */ = {isa = PBXBuildFile; fileRef = 321E60BD1F38E91700405457 /* UIImage+ForceDecode.m */; };
|
||||
321E60C81F38E91700405457 /* UIImage+ForceDecode.m in Sources */ = {isa = PBXBuildFile; fileRef = 321E60BD1F38E91700405457 /* UIImage+ForceDecode.m */; };
|
||||
321E60C91F38E91700405457 /* UIImage+ForceDecode.m in Sources */ = {isa = PBXBuildFile; fileRef = 321E60BD1F38E91700405457 /* UIImage+ForceDecode.m */; };
|
||||
3237F9E820161AE000A88143 /* NSImage+Additions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4397D2F51D0DE2DF00BB2784 /* NSImage+Additions.m */; };
|
||||
3237F9E920161AE000A88143 /* NSImage+Additions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4397D2F51D0DE2DF00BB2784 /* NSImage+Additions.m */; };
|
||||
3237F9EA20161AE000A88143 /* NSImage+Additions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4397D2F51D0DE2DF00BB2784 /* NSImage+Additions.m */; };
|
||||
3237F9EB20161AE000A88143 /* NSImage+Additions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4397D2F51D0DE2DF00BB2784 /* NSImage+Additions.m */; };
|
||||
3237F9EC20161AE000A88143 /* NSImage+Additions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4397D2F51D0DE2DF00BB2784 /* NSImage+Additions.m */; };
|
||||
323F8B3E1F38EF770092B609 /* alpha_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 323F8B131F38EF770092B609 /* alpha_enc.c */; };
|
||||
323F8B3F1F38EF770092B609 /* alpha_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 323F8B131F38EF770092B609 /* alpha_enc.c */; };
|
||||
323F8B401F38EF770092B609 /* alpha_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 323F8B131F38EF770092B609 /* alpha_enc.c */; };
|
||||
|
@ -488,8 +493,8 @@
|
|||
4397D2EA1D0DDD8C00BB2784 /* UIImage+GIF.h in Headers */ = {isa = PBXBuildFile; fileRef = A18A6CC5172DC28500419892 /* UIImage+GIF.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
4397D2EB1D0DDD8C00BB2784 /* NSData+ImageContentType.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D5B9140188EE8DD006D06BD /* NSData+ImageContentType.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
4397D2ED1D0DDD8C00BB2784 /* mux_types.h in Headers */ = {isa = PBXBuildFile; fileRef = DA577CC91998E60B007367ED /* mux_types.h */; };
|
||||
4397D2F61D0DE2DF00BB2784 /* NSImage+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 4397D2F41D0DE2DF00BB2784 /* NSImage+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
4397D2F71D0DE2DF00BB2784 /* NSImage+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 4397D2F51D0DE2DF00BB2784 /* NSImage+WebCache.m */; };
|
||||
4397D2F61D0DE2DF00BB2784 /* NSImage+Additions.h in Headers */ = {isa = PBXBuildFile; fileRef = 4397D2F41D0DE2DF00BB2784 /* NSImage+Additions.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
4397D2F71D0DE2DF00BB2784 /* NSImage+Additions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4397D2F51D0DE2DF00BB2784 /* NSImage+Additions.m */; };
|
||||
4397D2F81D0DF44200BB2784 /* MKAnnotationView+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 535699B415113E7300A4C397 /* MKAnnotationView+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
4397D2F91D0DF44A00BB2784 /* MKAnnotationView+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 535699B515113E7300A4C397 /* MKAnnotationView+WebCache.m */; };
|
||||
43A62A1B1D0E0A800089D7DD /* decode.h in Headers */ = {isa = PBXBuildFile; fileRef = DA577CC41998E60B007367ED /* decode.h */; };
|
||||
|
@ -1341,8 +1346,8 @@
|
|||
4369C2751D9807EC007E863A /* UIView+WebCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIView+WebCache.h"; path = "SDWebImage/UIView+WebCache.h"; sourceTree = "<group>"; };
|
||||
4369C2761D9807EC007E863A /* UIView+WebCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIView+WebCache.m"; path = "SDWebImage/UIView+WebCache.m"; sourceTree = "<group>"; };
|
||||
4397D2F21D0DDD8C00BB2784 /* SDWebImage.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SDWebImage.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
4397D2F41D0DE2DF00BB2784 /* NSImage+WebCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSImage+WebCache.h"; path = "SDWebImage/NSImage+WebCache.h"; sourceTree = "<group>"; };
|
||||
4397D2F51D0DE2DF00BB2784 /* NSImage+WebCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSImage+WebCache.m"; path = "SDWebImage/NSImage+WebCache.m"; sourceTree = "<group>"; };
|
||||
4397D2F41D0DE2DF00BB2784 /* NSImage+Additions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSImage+Additions.h"; sourceTree = "<group>"; };
|
||||
4397D2F51D0DE2DF00BB2784 /* NSImage+Additions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSImage+Additions.m"; sourceTree = "<group>"; };
|
||||
43A918621D8308FE00B3925F /* SDImageCacheConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDImageCacheConfig.h; sourceTree = "<group>"; };
|
||||
43A918631D8308FE00B3925F /* SDImageCacheConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDImageCacheConfig.m; sourceTree = "<group>"; };
|
||||
43C892981D9D6DD70022038D /* anim_decode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = anim_decode.c; sourceTree = "<group>"; };
|
||||
|
@ -1640,8 +1645,6 @@
|
|||
children = (
|
||||
329A18571FFF5DFD008C9A2F /* UIImage+WebCache.h */,
|
||||
329A18581FFF5DFD008C9A2F /* UIImage+WebCache.m */,
|
||||
4397D2F41D0DE2DF00BB2784 /* NSImage+WebCache.h */,
|
||||
4397D2F51D0DE2DF00BB2784 /* NSImage+WebCache.m */,
|
||||
535699B415113E7300A4C397 /* MKAnnotationView+WebCache.h */,
|
||||
535699B515113E7300A4C397 /* MKAnnotationView+WebCache.m */,
|
||||
53922D93148C56230056699D /* UIButton+WebCache.h */,
|
||||
|
@ -1778,6 +1781,8 @@
|
|||
53EDFB921762547C00698166 /* UIImage+WebP.m */,
|
||||
321E60BC1F38E91700405457 /* UIImage+ForceDecode.h */,
|
||||
321E60BD1F38E91700405457 /* UIImage+ForceDecode.m */,
|
||||
4397D2F41D0DE2DF00BB2784 /* NSImage+Additions.h */,
|
||||
4397D2F51D0DE2DF00BB2784 /* NSImage+Additions.m */,
|
||||
AB615301192DA24600A2D8E9 /* UIView+WebCacheOperation.h */,
|
||||
AB615302192DA24600A2D8E9 /* UIView+WebCacheOperation.m */,
|
||||
);
|
||||
|
@ -2280,7 +2285,7 @@
|
|||
80377E661F2F66A800F89830 /* neon.h in Headers */,
|
||||
4397D2DB1D0DDD8C00BB2784 /* UIImage+MultiFormat.h in Headers */,
|
||||
4397D2DC1D0DDD8C00BB2784 /* SDWebImageOperation.h in Headers */,
|
||||
4397D2F61D0DE2DF00BB2784 /* NSImage+WebCache.h in Headers */,
|
||||
4397D2F61D0DE2DF00BB2784 /* NSImage+Additions.h in Headers */,
|
||||
4397D2E11D0DDD8C00BB2784 /* SDWebImageDownloader.h in Headers */,
|
||||
323F8BFB1F38EF770092B609 /* animi.h in Headers */,
|
||||
4397D2E31D0DDD8C00BB2784 /* MKAnnotationView+WebCache.h in Headers */,
|
||||
|
@ -2722,6 +2727,7 @@
|
|||
80377C4E1F2F666300F89830 /* filters_utils.c in Sources */,
|
||||
321E60B91F38E90100405457 /* SDWebImageWebPCoder.m in Sources */,
|
||||
80377DEB1F2F66A700F89830 /* yuv.c in Sources */,
|
||||
3237F9E920161AE000A88143 /* NSImage+Additions.m in Sources */,
|
||||
00733A551BC4880000A5A117 /* SDWebImageDownloader.m in Sources */,
|
||||
80377EB71F2F66D400F89830 /* alpha_dec.c in Sources */,
|
||||
80377DC61F2F66A700F89830 /* enc.c in Sources */,
|
||||
|
@ -2922,6 +2928,7 @@
|
|||
80377D1F1F2F66A700F89830 /* alpha_processing_neon.c in Sources */,
|
||||
4314D1401D0E0E3B004B36C9 /* UIImageView+WebCache.m in Sources */,
|
||||
43A9186C1D8308FE00B3925F /* SDImageCacheConfig.m in Sources */,
|
||||
3237F9EC20161AE000A88143 /* NSImage+Additions.m in Sources */,
|
||||
4314D1411D0E0E3B004B36C9 /* SDWebImageDownloaderOperation.m in Sources */,
|
||||
80377D561F2F66A700F89830 /* rescaler_neon.c in Sources */,
|
||||
80377D551F2F66A700F89830 /* rescaler_msa.c in Sources */,
|
||||
|
@ -3066,6 +3073,7 @@
|
|||
323F8C0C1F38EF770092B609 /* muxedit.c in Sources */,
|
||||
80377DEE1F2F66A800F89830 /* alpha_processing_neon.c in Sources */,
|
||||
43C892A41D9D6DDD0022038D /* demux.c in Sources */,
|
||||
3237F9EA20161AE000A88143 /* NSImage+Additions.m in Sources */,
|
||||
431BB6B61D06D2C1006A3455 /* UIImage+WebP.m in Sources */,
|
||||
80377E251F2F66A800F89830 /* rescaler_neon.c in Sources */,
|
||||
80377E241F2F66A800F89830 /* rescaler_msa.c in Sources */,
|
||||
|
@ -3125,7 +3133,7 @@
|
|||
321E60911F38E8C800405457 /* SDWebImageCoder.m in Sources */,
|
||||
80377C8A1F2F666400F89830 /* quant_levels_utils.c in Sources */,
|
||||
4397D27F1D0DDD8C00BB2784 /* UIImage+WebP.m in Sources */,
|
||||
4397D2F71D0DE2DF00BB2784 /* NSImage+WebCache.m in Sources */,
|
||||
4397D2F71D0DE2DF00BB2784 /* NSImage+Additions.m in Sources */,
|
||||
80377E751F2F66A800F89830 /* yuv.c in Sources */,
|
||||
43C892A01D9D6DDA0022038D /* anim_decode.c in Sources */,
|
||||
80377E4A1F2F66A800F89830 /* enc_mips_dsp_r2.c in Sources */,
|
||||
|
@ -3304,6 +3312,7 @@
|
|||
80377DA61F2F66A700F89830 /* yuv.c in Sources */,
|
||||
321E60B81F38E90100405457 /* SDWebImageWebPCoder.m in Sources */,
|
||||
43CE757A1CFE9427006C64D0 /* FLAnimatedImage.m in Sources */,
|
||||
3237F9E820161AE000A88143 /* NSImage+Additions.m in Sources */,
|
||||
80377D811F2F66A700F89830 /* enc.c in Sources */,
|
||||
80377EA71F2F66D400F89830 /* alpha_dec.c in Sources */,
|
||||
80377D8F1F2F66A700F89830 /* lossless_mips_dsp_r2.c in Sources */,
|
||||
|
@ -3452,6 +3461,7 @@
|
|||
321E60B61F38E90100405457 /* SDWebImageWebPCoder.m in Sources */,
|
||||
43CE75791CFE9427006C64D0 /* FLAnimatedImage.m in Sources */,
|
||||
80377CF71F2F66A100F89830 /* enc.c in Sources */,
|
||||
3237F9EB20161AE000A88143 /* NSImage+Additions.m in Sources */,
|
||||
80377E871F2F66D000F89830 /* alpha_dec.c in Sources */,
|
||||
80377D051F2F66A100F89830 /* lossless_mips_dsp_r2.c in Sources */,
|
||||
80377C0A1F2F665300F89830 /* random_utils.c in Sources */,
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* This file is part of the SDWebImage package.
|
||||
* (c) Olivier Poitrey <rs@dailymotion.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
#import "SDWebImageCompat.h"
|
||||
|
||||
// This category is provided to easily write cross-platform code. For common usage, see `UIImage+WebCache`.
|
||||
|
||||
#if SD_MAC
|
||||
|
||||
@interface NSImage (Additions)
|
||||
|
||||
@property (nonatomic, readonly, nullable) CGImageRef CGImage;
|
||||
@property (nonatomic, readonly, nullable) NSArray<NSImage *> *images;
|
||||
@property (nonatomic, readonly) CGFloat scale;
|
||||
|
||||
- (nonnull instancetype)initWithCGImage:(nonnull CGImageRef)cgImage scale:(CGFloat)scale;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* This file is part of the SDWebImage package.
|
||||
* (c) Olivier Poitrey <rs@dailymotion.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
#import "NSImage+Additions.h"
|
||||
|
||||
#if SD_MAC
|
||||
|
||||
@implementation NSImage (Additions)
|
||||
|
||||
- (CGImageRef)CGImage {
|
||||
NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height);
|
||||
CGImageRef cgImage = [self CGImageForProposedRect:&imageRect context:NULL hints:nil];
|
||||
return cgImage;
|
||||
}
|
||||
|
||||
- (NSArray<NSImage *> *)images {
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (CGFloat)scale {
|
||||
CGFloat scale = 1;
|
||||
NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height);
|
||||
NSImageRep *rep = [self bestRepresentationForRect:imageRect context:NULL hints:nil];
|
||||
NSInteger pixelsWide = rep.pixelsWide;
|
||||
CGFloat width = rep.size.width;
|
||||
if (width > 0) {
|
||||
scale = pixelsWide / width;
|
||||
}
|
||||
return scale;
|
||||
}
|
||||
|
||||
- (instancetype)initWithCGImage:(CGImageRef)cgImage scale:(CGFloat)scale {
|
||||
NSSize size;
|
||||
if (cgImage && scale > 0) {
|
||||
NSInteger pixelsWide = CGImageGetWidth(cgImage);
|
||||
NSInteger pixelsHigh = CGImageGetHeight(cgImage);
|
||||
CGFloat width = pixelsWide / scale;
|
||||
CGFloat height = pixelsHigh / scale;
|
||||
size = NSMakeSize(width, height);
|
||||
} else {
|
||||
size = NSZeroSize;
|
||||
}
|
||||
return [self initWithCGImage:cgImage size:size];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
|
@ -1,20 +0,0 @@
|
|||
/*
|
||||
* This file is part of the SDWebImage package.
|
||||
* (c) Olivier Poitrey <rs@dailymotion.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
#import "SDWebImageCompat.h"
|
||||
|
||||
#if SD_MAC
|
||||
|
||||
@interface NSImage (Additions)
|
||||
|
||||
- (nullable CGImageRef)CGImage;
|
||||
- (nullable NSArray<NSImage *> *)images;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
|
@ -1,28 +0,0 @@
|
|||
/*
|
||||
* This file is part of the SDWebImage package.
|
||||
* (c) Olivier Poitrey <rs@dailymotion.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
#import "NSImage+WebCache.h"
|
||||
|
||||
#if SD_MAC
|
||||
|
||||
@implementation NSImage (Additions)
|
||||
|
||||
- (CGImageRef)CGImage {
|
||||
NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height);
|
||||
CGImageRef cgImage = [self CGImageForProposedRect:&imageRect context:NULL hints:nil];
|
||||
return cgImage;
|
||||
}
|
||||
|
||||
- (NSArray<NSImage *> *)images {
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#import "SDImageCache.h"
|
||||
#import <CommonCrypto/CommonDigest.h>
|
||||
#import "NSImage+WebCache.h"
|
||||
#import "NSImage+Additions.h"
|
||||
#import "SDWebImageCodersManager.h"
|
||||
|
||||
static void * SDImageCacheContext = &SDImageCacheContext;
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
#import "SDWebImageCoderHelper.h"
|
||||
#import "SDWebImageFrame.h"
|
||||
#import "UIImage+MultiFormat.h"
|
||||
#import "NSImage+WebCache.h"
|
||||
#import "NSImage+Additions.h"
|
||||
#import "NSData+ImageContentType.h"
|
||||
#import <ImageIO/ImageIO.h>
|
||||
|
||||
@implementation SDWebImageCoderHelper
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#import "SDWebImageCompat.h"
|
||||
#import "UIImage+WebCache.h"
|
||||
#import "NSImage+Additions.h"
|
||||
|
||||
#if !__has_feature(objc_arc)
|
||||
#error SDWebImage is ARC only. Either turn on ARC for the project or use -fobjc-arc flag
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#import "SDWebImageDownloaderOperation.h"
|
||||
#import "SDWebImageManager.h"
|
||||
#import "NSImage+WebCache.h"
|
||||
#import "NSImage+Additions.h"
|
||||
#import "SDWebImageCodersManager.h"
|
||||
|
||||
NSString *const SDWebImageDownloadStartNotification = @"SDWebImageDownloadStartNotification";
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
#import "SDWebImageGIFCoder.h"
|
||||
#import "NSImage+WebCache.h"
|
||||
#import "NSImage+Additions.h"
|
||||
#import "UIImage+WebCache.h"
|
||||
#import <ImageIO/ImageIO.h>
|
||||
#import "NSData+ImageContentType.h"
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#import "SDWebImageImageIOCoder.h"
|
||||
#import "SDWebImageCoderHelper.h"
|
||||
#import "NSImage+WebCache.h"
|
||||
#import "NSImage+Additions.h"
|
||||
#import <ImageIO/ImageIO.h>
|
||||
#import "NSData+ImageContentType.h"
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
#import "SDWebImageManager.h"
|
||||
#import "NSImage+WebCache.h"
|
||||
#import "NSImage+Additions.h"
|
||||
#import <objc/message.h>
|
||||
|
||||
@interface SDWebImageCombinedOperation : NSObject <SDWebImageOperation>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#import "SDWebImageWebPCoder.h"
|
||||
#import "SDWebImageCoderHelper.h"
|
||||
#import "NSImage+WebCache.h"
|
||||
#import "NSImage+Additions.h"
|
||||
#import "UIImage+WebCache.h"
|
||||
#if __has_include(<webp/decode.h>) && __has_include(<webp/encode.h>) && __has_include(<webp/demux.h>) && __has_include(<webp/mux.h>)
|
||||
#import <webp/decode.h>
|
||||
|
|
|
@ -7,11 +7,39 @@
|
|||
*/
|
||||
|
||||
#import "UIImage+WebCache.h"
|
||||
|
||||
#if SD_UIKIT
|
||||
|
||||
#import "objc/runtime.h"
|
||||
|
||||
@implementation UIImage (WebCache)
|
||||
|
||||
- (NSUInteger)sd_imageLoopCount {
|
||||
NSUInteger imageLoopCount = 0;
|
||||
NSNumber *value = objc_getAssociatedObject(self, @selector(sd_imageLoopCount));
|
||||
if ([value isKindOfClass:[NSNumber class]]) {
|
||||
imageLoopCount = value.unsignedIntegerValue;
|
||||
}
|
||||
return imageLoopCount;
|
||||
}
|
||||
|
||||
- (void)setSd_imageLoopCount:(NSUInteger)sd_imageLoopCount {
|
||||
NSNumber *value = @(sd_imageLoopCount);
|
||||
objc_setAssociatedObject(self, @selector(sd_imageLoopCount), value, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
}
|
||||
|
||||
- (BOOL)sd_isAnimated {
|
||||
return (self.images != nil);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
||||
#if SD_MAC
|
||||
|
||||
@implementation NSImage (WebCache)
|
||||
|
||||
- (NSUInteger)sd_imageLoopCount {
|
||||
NSUInteger imageLoopCount = 0;
|
||||
for (NSImageRep *rep in self.representations) {
|
||||
|
@ -47,25 +75,6 @@
|
|||
return isGIF;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
- (NSUInteger)sd_imageLoopCount {
|
||||
NSUInteger imageLoopCount = 0;
|
||||
NSNumber *value = objc_getAssociatedObject(self, @selector(sd_imageLoopCount));
|
||||
if ([value isKindOfClass:[NSNumber class]]) {
|
||||
imageLoopCount = value.unsignedIntegerValue;
|
||||
}
|
||||
return imageLoopCount;
|
||||
}
|
||||
|
||||
- (void)setSd_imageLoopCount:(NSUInteger)sd_imageLoopCount {
|
||||
NSNumber *value = @(sd_imageLoopCount);
|
||||
objc_setAssociatedObject(self, @selector(sd_imageLoopCount), value, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
}
|
||||
|
||||
- (BOOL)sd_isAnimated {
|
||||
return (self.images != nil);
|
||||
}
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
|
@ -53,7 +53,7 @@ FOUNDATION_EXPORT const unsigned char WebImageVersionString[];
|
|||
#import <SDWebImage/NSData+ImageContentType.h>
|
||||
|
||||
#if SD_MAC
|
||||
#import <SDWebImage/NSImage+WebCache.h>
|
||||
#import <SDWebImage/NSImage+Additions.h>
|
||||
#endif
|
||||
|
||||
#if SD_UIKIT
|
||||
|
|
Loading…
Reference in New Issue