UIViewController(FWBlock)

@interface UIViewController (FWBlock)

iOS13+支持针对VC.navigationItem单独设置导航栏样式,如最低兼容iOS13时可使用

  • 快捷设置导航栏标题

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) NSString *fw_title;
  • 设置导航栏返回按钮,支持UIBarButtonItem|NSString|UIImage等,nil时显示系统箭头,下个页面生效

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) id fw_backBarItem;
  • 设置导航栏左侧按钮,支持UIBarButtonItem|UIImage等,默认事件为关闭当前页面,下个页面生效

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) id fw_leftBarItem;
  • 设置导航栏右侧按钮,支持UIBarButtonItem|UIImage等,默认事件为关闭当前页面,下个页面生效

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) id fw_rightBarItem;
  • 快捷设置导航栏左侧按钮。注意自定义left按钮之后,系统返回手势失效

    Declaration

    Objective-C

    - (void)fw_setLeftBarItem:(nullable id)object
                       target:(nonnull id)target
                       action:(nonnull SEL)action;
  • 快捷设置导航栏左侧按钮,block事件。注意自定义left按钮之后,系统返回手势失效

    Declaration

    Objective-C

    - (void)fw_setLeftBarItem:(nullable id)object
                        block:(nonnull void (^)(id _Nonnull))block;
  • 快捷设置导航栏右侧按钮

    Declaration

    Objective-C

    - (void)fw_setRightBarItem:(nullable id)object
                        target:(nonnull id)target
                        action:(nonnull SEL)action;
  • 快捷设置导航栏右侧按钮,block事件

    Declaration

    Objective-C

    - (void)fw_setRightBarItem:(nullable id)object
                         block:(nonnull void (^)(id _Nonnull))block;
  • 快捷添加导航栏左侧按钮。注意自定义left按钮之后,系统返回手势失效

    Declaration

    Objective-C

    - (void)fw_addLeftBarItem:(nullable id)object
                       target:(nonnull id)target
                       action:(nonnull SEL)action;
  • 快捷添加导航栏左侧按钮,block事件。注意自定义left按钮之后,系统返回手势失效

    Declaration

    Objective-C

    - (void)fw_addLeftBarItem:(nullable id)object
                        block:(nonnull void (^)(id _Nonnull))block;
  • 快捷添加导航栏右侧按钮

    Declaration

    Objective-C

    - (void)fw_addRightBarItem:(nullable id)object
                        target:(nonnull id)target
                        action:(nonnull SEL)action;
  • 快捷添加导航栏右侧按钮,block事件

    Declaration

    Objective-C

    - (void)fw_addRightBarItem:(nullable id)object
                         block:(nonnull void (^)(id _Nonnull))block;