SDAnimatedImage

@interface SDAnimatedImage : UIImage <SDAnimatedImage>

The image class which supports animating on SDAnimatedImageView. You can also use it on normal UIImageView/NSImageView.

  • Declaration

    Objective-C

    + (nullable instancetype)imageNamed:(nonnull NSString *)name;

    Swift

    /*not inherited*/ init?(named name: String)
  • Declaration

    Objective-C

    + (nullable instancetype)imageNamed:(nonnull NSString *)name inBundle:(nullable NSBundle *)bundle compatibleWithTraitCollection:(nullable UITraitCollection *)traitCollection;

    Swift

    /*not inherited*/ init?(named name: String, in bundle: Bundle?, compatibleWith traitCollection: UITraitCollection?)
  • Declaration

    Objective-C

    + (nullable instancetype)imageWithContentsOfFile:(nonnull NSString *)path;
  • Declaration

    Objective-C

    + (nullable instancetype)imageWithData:(nonnull NSData *)data;
  • Declaration

    Objective-C

    + (nullable instancetype)imageWithData:(nonnull NSData *)data scale:(CGFloat)scale;
  • Declaration

    Objective-C

    - (nullable instancetype)initWithContentsOfFile:(nonnull NSString *)path;

    Swift

    init?(contentsOfFile path: String)
  • Declaration

    Objective-C

    - (nullable instancetype)initWithData:(nonnull NSData *)data;

    Swift

    init?(data: Data)
  • Declaration

    Objective-C

    - (nullable instancetype)initWithData:(nonnull NSData *)data scale:(CGFloat)scale;

    Swift

    init?(data: Data, scale: CGFloat)
  • Current animated image format.

    Declaration

    Objective-C

    @property (readonly, nonatomic) SDImageFormat animatedImageFormat;

    Swift

    var animatedImageFormat: SDImageFormat { get }
  • Current animated image data, you can use this to grab the compressed format data and create another animated image instance. If this image instance is an animated image created by using animated image coder (which means using the API listed above or using initWithAnimatedCoder:scale:), this property is non-nil.

    Declaration

    Objective-C

    @property (readonly, copy, nonatomic, nullable) NSData *animatedImageData;

    Swift

    var animatedImageData: Data? { get }
  • The scale factor of the image.

    Note

    For UIKit, this just call super instead.

    Note

    For AppKit, NSImage can contains multiple image representations with different scales. However, this class does not do that from the design. We process the scale like UIKit. This will actually be calculated from image size and pixel size.

    Declaration

    Objective-C

    @property (readonly, nonatomic) CGFloat scale;

    Swift

    var scale: CGFloat { get }
  • Declaration

    Objective-C

    - (void)preloadAllFrames;

    Swift

    func preloadAllFrames()
  • Declaration

    Objective-C

    - (void)unloadAllFrames;

    Swift

    func unloadAllFrames()
  • Declaration

    Objective-C

    @property (nonatomic, readonly, getter=isAllFramesLoaded) BOOL allFramesLoaded

    Swift

    var isAllFramesLoaded: Bool { get }