UIToolbar(FWBarAppearance)
@interface UIToolbar (FWBarAppearance)
工具栏样式分类,全局设置用[UIToolbar appearance]。iOS15+启用appearance,iOS14及以下使用旧版本api
Note
工具栏高度建议用sizeToFit自动获取(示例44),contentView为内容视图(示例44),backgroundView为背景视图(示例78)-
工具栏iOS13+样式对象,用于自定义样式,默认透明
Declaration
Objective-C
@property (nonatomic, strong, readonly) API_AVAILABLE(ios(13.0)) UIToolbarAppearance *fw_appearance;
-
手工更新工具栏样式
Declaration
Objective-C
- (void)fw_updateAppearance;
-
工具栏是否半透明,会重置背景,需优先设置,默认NO;背景色需带有alpha时半透明才会生效
Declaration
Objective-C
@property (nonatomic) BOOL fw_isTranslucent;
-
设置前景颜色,包含文字和按钮等
Declaration
Objective-C
@property (nonatomic, strong, nullable) UIColor *fw_foregroundColor;
-
单独设置按钮样式属性,nil时系统默认。仅iOS15+生效,iOS14及以下请使用UIBarButtonItem
Declaration
Objective-C
@property (nonatomic, copy, nullable) NSDictionary<NSAttributedStringKey, id> *fw_buttonAttributes;
-
设置背景颜色,兼容主题颜色,后设置生效
Declaration
Objective-C
@property (nonatomic, strong, nullable) UIColor *fw_backgroundColor;
-
设置背景图片,兼容主题图片,后设置生效
Declaration
Objective-C
@property (nonatomic, strong, nullable) UIImage *fw_backgroundImage;
-
设置背景是否全透明,默认NO,后设置生效
Declaration
Objective-C
@property (nonatomic) BOOL fw_backgroundTransparent;
-
设置阴影颜色(nil时透明),兼容主题颜色,后设置生效
Declaration
Objective-C
@property (nonatomic, strong, nullable) UIColor *fw_shadowColor;
-
设置阴影图片(nil时透明),兼容主题图片,后设置生效
Declaration
Objective-C
@property (nonatomic, strong, nullable) UIImage *fw_shadowImage;
-
自定义工具栏位置,调用后才生效,会自动设置delegate。Bottom时背景自动向下延伸,TopAttached时背景自动向上延伸
Declaration
Objective-C
@property (nonatomic) UIBarPosition fw_barPosition;