FWNavigationBarAppearance


@interface FWNavigationBarAppearance : NSObject

导航栏样式配置

  • 是否半透明(磨砂),需edgesForExtendedLayout为Top|All,默认NO

    Declaration

    Objective-C

    @property (nonatomic) BOOL isTranslucent;
  • 前景色,包含标题和按钮,默认nil

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) UIColor *foregroundColor;
  • 标题属性,默认nil使用前景色

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) NSDictionary<NSAttributedStringKey, id> *titleAttributes;
  • 按钮属性,默认nil。仅iOS15+生效,iOS14及以下请使用UIBarButtonItem

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) NSDictionary<NSAttributedStringKey, id> *buttonAttributes;
  • 背景色,后设置生效,默认nil

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) UIColor *backgroundColor;
  • 背景图片,后设置生效,默认nil

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) UIImage *backgroundImage;
  • 背景透明,需edgesForExtendedLayout为Top|All,后设置生效,默认NO

    Declaration

    Objective-C

    @property (nonatomic) BOOL backgroundTransparent;
  • 阴影颜色,后设置生效,默认nil

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) UIColor *shadowColor;
  • 阴影图片,后设置生效,默认nil

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) UIImage *shadowImage;
  • 返回按钮图片,自动配合VC导航栏样式生效,默认nil

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) UIImage *backImage;
  • 左侧返回按钮图片,自动配合VC导航栏样式生效,默认nil

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) UIImage *leftBackImage;
  • 自定义句柄,最后调用,可自定义样式,默认nil

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) void (^) (UINavigationBar *_Nonnull __strong) appearanceBlock;
  • 根据style获取全局appearance对象

    Declaration

    Objective-C

    + (nullable FWNavigationBarAppearance *)appearanceForStyle:
        (FWNavigationBarStyle)style;
  • 设置style对应全局appearance对象

    Declaration

    Objective-C

    + (void)setAppearance:(nullable FWNavigationBarAppearance *)appearance
                 forStyle:(FWNavigationBarStyle)style;