UINavigationBar(FWBarAppearance)

@interface UINavigationBar (FWBarAppearance)

导航栏视图分类,全局设置用[UINavigationBar appearance]。iOS15+启用appearance,iOS14及以下使用旧版本api

  • 设置全局按钮样式属性,nil时系统默认

    Declaration

    Objective-C

    @property (class, nonatomic, copy, nullable) NSDictionary<NSAttributedStringKey, id> *fw_buttonAttributes;
  • 导航栏iOS13+样式对象,用于自定义样式,默认透明

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) API_AVAILABLE(ios(13.0)) UINavigationBarAppearance *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时显示前景颜色

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) NSDictionary<NSAttributedStringKey, id> *fw_titleAttributes;
  • 单独设置按钮样式属性,nil时系统默认。仅iOS15+生效,iOS14及以下请使用UIBarButtonItem

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) NSDictionary<NSAttributedStringKey, id> *fw_buttonAttributes;
  • 设置背景颜色(nil时透明),兼容主题颜色,后设置生效

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) UIColor *fw_backgroundColor;
  • 设置背景图片(nil时透明),兼容主题图片,后设置生效

    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;
  • 设置返回按钮图片,包含图片和转场Mask图片,自动偏移和系统左侧按钮位置保持一致

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) UIImage *fw_backImage;