UIImage(FWImagePlugin)

@interface UIImage (FWImagePlugin)

/// 根据名称加载UIImage,优先加载图片文件(无缓存),文件不存在时尝试系统imageNamed方式(有缓存)
+ (nullable UIImage *)fw_imageNamed:(NSString *)name NS_REFINED_FOR_SWIFT;

/// 根据名称从指定bundle加载UIImage,优先加载图片文件(无缓存),文件不存在时尝试系统imageNamed方式(有缓存)
+ (nullable UIImage *)fw_imageNamed:(NSString *)name bundle:(nullable NSBundle *)bundle NS_REFINED_FOR_SWIFT;

/// 根据名称从指定bundle加载UIImage,优先加载图片文件(无缓存),文件不存在时尝试系统imageNamed方式(有缓存)。支持设置图片解码选项
+ (nullable UIImage *)fw_imageNamed:(NSString *)name bundle:(nullable NSBundle *)bundle options:(nullable NSDictionary<FWImageCoderOptions, id> *)options NS_REFINED_FOR_SWIFT;

/// 从图片文件路径解码创建UIImage,自动识别scale,支持动图
+ (nullable UIImage *)fw_imageWithContentsOfFile:(NSString *)path NS_REFINED_FOR_SWIFT;

/// 从图片数据解码创建UIImage,scale为1,支持动图
+ (nullable UIImage *)fw_imageWithData:(nullable NSData *)data NS_REFINED_FOR_SWIFT;

/// 从图片数据解码创建UIImage,指定scale,支持动图
+ (nullable UIImage *)fw_imageWithData:(nullable NSData *)data scale:(CGFloat)scale NS_REFINED_FOR_SWIFT;

/// 从图片数据解码创建UIImage,指定scale,支持动图。支持设置图片解码选项
+ (nullable UIImage *)fw_imageWithData:(nullable NSData *)data scale:(CGFloat)scale options:(nullable NSDictionary<FWImageCoderOptions, id> *)options NS_REFINED_FOR_SWIFT;

/// 从UIImage编码创建图片数据,支持动图
+ (nullable NSData *)fw_dataWithImage:(nullable UIImage *)image NS_REFINED_FOR_SWIFT;

/// 从UIImage编码创建图片数据,支持动图。支持设置图片编码选项
+ (nullable NSData *)fw_dataWithImage:(nullable UIImage *)image options:(nullable NSDictionary<FWImageCoderOptions, id> *)options NS_REFINED_FOR_SWIFT;

/// 下载网络图片并返回下载凭据
+ (nullable id)fw_downloadImage:(nullable id)url
                    completion:(void (^)(UIImage * _Nullable image, NSError * _Nullable error))completion
                      progress:(nullable void (^)(double progress))progress NS_REFINED_FOR_SWIFT;

/// 下载网络图片并返回下载凭据,指定option
+ (nullable id)fw_downloadImage:(nullable id)url
                       options:(FWWebImageOptions)options
                       context:(nullable NSDictionary<FWImageCoderOptions, id> *)context
                    completion:(void (^)(UIImage * _Nullable image, NSError * _Nullable error))completion
                      progress:(nullable void (^)(double progress))progress NS_REFINED_FOR_SWIFT;

/// 指定下载凭据取消网络图片下载
+ (void)fw_cancelImageDownload:(nullable id)receipt NS_REFINED_FOR_SWIFT;

@end

Undocumented

  • 根据名称加载UIImage,优先加载图片文件(无缓存),文件不存在时尝试系统imageNamed方式(有缓存)

    Declaration

    Objective-C

    + (nullable UIImage *)fw_imageNamed:(nonnull NSString *)name;
  • 根据名称从指定bundle加载UIImage,优先加载图片文件(无缓存),文件不存在时尝试系统imageNamed方式(有缓存)

    Declaration

    Objective-C

    + (nullable UIImage *)fw_imageNamed:(nonnull NSString *)name
                                 bundle:(nullable NSBundle *)bundle;
  • 根据名称从指定bundle加载UIImage,优先加载图片文件(无缓存),文件不存在时尝试系统imageNamed方式(有缓存)。支持设置图片解码选项

    Declaration

    Objective-C

    + (nullable UIImage *)
        fw_imageNamed:(nonnull NSString *)name
               bundle:(nullable NSBundle *)bundle
              options:(nullable NSDictionary<FWImageCoderOptions, id> *)options;
  • 从图片文件路径解码创建UIImage,自动识别scale,支持动图

    Declaration

    Objective-C

    + (nullable UIImage *)fw_imageWithContentsOfFile:(nonnull NSString *)path;
  • 从图片数据解码创建UIImage,scale为1,支持动图

    Declaration

    Objective-C

    + (nullable UIImage *)fw_imageWithData:(nullable NSData *)data;
  • 从图片数据解码创建UIImage,指定scale,支持动图

    Declaration

    Objective-C

    + (nullable UIImage *)fw_imageWithData:(nullable NSData *)data
                                     scale:(CGFloat)scale;
  • 从图片数据解码创建UIImage,指定scale,支持动图。支持设置图片解码选项

    Declaration

    Objective-C

    + (nullable UIImage *)
        fw_imageWithData:(nullable NSData *)data
                   scale:(CGFloat)scale
                 options:(nullable NSDictionary<FWImageCoderOptions, id> *)options;
  • 从UIImage编码创建图片数据,支持动图

    Declaration

    Objective-C

    + (nullable NSData *)fw_dataWithImage:(nullable UIImage *)image;
  • 从UIImage编码创建图片数据,支持动图。支持设置图片编码选项

    Declaration

    Objective-C

    + (nullable NSData *)
        fw_dataWithImage:(nullable UIImage *)image
                 options:(nullable NSDictionary<FWImageCoderOptions, id> *)options;
  • 下载网络图片并返回下载凭据

    Declaration

    Objective-C

    + (nullable id)
        fw_downloadImage:(nullable id)url
              completion:(nonnull void (^)(UIImage *_Nullable __strong,
                                           NSError *_Nullable __strong))completion
                progress:(nullable void (^)(double))progress;
  • 下载网络图片并返回下载凭据,指定option

    Declaration

    Objective-C

    + (nullable id)
        fw_downloadImage:(nullable id)url
                 options:(FWWebImageOptions)options
                 context:(nullable NSDictionary<FWImageCoderOptions, id> *)context
              completion:(nonnull void (^)(UIImage *_Nullable __strong,
                                           NSError *_Nullable __strong))completion
                progress:(nullable void (^)(double))progress;
  • 指定下载凭据取消网络图片下载

    Declaration

    Objective-C

    + (void)fw_cancelImageDownload:(nullable id)receipt;