UIImage(FWTheme)
@interface UIImage (FWTheme)
UIImage主题分类
Note
注意UIImage默认只有name方式且配置了any和dark才支持动态切换,否则只能重新赋值才会变化。 为避免内存泄漏,通过fwTheme方式创建的主题图片不能直接用于显示,显示时请调用fwImage方法-
创建主题模拟动态图像,分别指定浅色和深色,不支持动态切换,需重新赋值才会变化
Declaration
Objective-C
+ (nonnull UIImage *)fw_themeLight:(nullable UIImage *)light dark:(nullable UIImage *)dark;
-
创建主题模拟动态图像,指定提供句柄,不支持动态切换,需重新赋值才会变化
Declaration
Objective-C
+ (nonnull UIImage *)fw_themeImage: (nonnull UIImage *_Nullable (^)(FWThemeStyle))provider;
-
创建主题模拟动态图像,指定名称,兼容系统方式(仅iOS13+支持动态图像)和手工指定,支持动态切换,需配置any和dark
Declaration
Objective-C
+ (nonnull UIImage *)fw_themeNamed:(nonnull NSString *)name;
-
创建主题模拟动态图像,指定名称和bundle,兼容系统方式(仅iOS13+支持动态图像)和手工指定,支持动态切换,需配置any和dark
Declaration
Objective-C
+ (nonnull UIImage *)fw_themeNamed:(nonnull NSString *)name bundle:(nullable NSBundle *)bundle;
-
手工单个注册主题图像,未配置主题图像时可使用本方式
Declaration
Objective-C
+ (void)fw_setThemeImage:(nullable UIImage *)image forName:(nonnull NSString *)name;
-
手工批量注册主题图像,未配置主题图像时可使用本方式
Declaration
Objective-C
+ (void)fw_setThemeImages: (nonnull NSDictionary<NSString *, UIImage *> *)nameImages;
-
获取当前主题样式对应静态图片用于显示,iOS13+可跟随系统改变
Declaration
Objective-C
@property (nonatomic, readonly, nullable) UIImage *fw_image;
-
指定主题样式获取对应静态图片用于显示,iOS13+可跟随系统改变
Declaration
Objective-C
- (nullable UIImage *)fw_imageForStyle:(FWThemeStyle)style;
-
是否是主题图片,仅支持判断使用fwTheme创建的图片
Declaration
Objective-C
@property (nonatomic, readonly) BOOL fw_isThemeImage;
-
默认主题图片颜色,未设置时为浅色=>黑色,深色=>白色
Declaration
Objective-C
@property (class, nonatomic, strong, readonly) NS_REFINED_FOR_SWIFT UIColor *fw_themeImageColor;
-
默认主题图片颜色配置句柄,默认nil
Declaration
Objective-C
@property (class, nonatomic, copy, nullable) UIColor *_Nonnull (^) (void) fw_themeImageColorConfiguration;
-
快速生成当前图片对应的默认主题图片
Declaration
Objective-C
@property (nonatomic, strong, readonly) NS_SWIFT_NAME(__fw_themeImage) UIImage *fw_themeImage;
-
指定主题颜色,快速生成当前图片对应的主题图片
Declaration
Objective-C
- (nonnull UIImage *)fw_themeImageWithColor:(nonnull UIColor *)themeColor;