UIViewController(FWAdaptive)

@interface UIViewController (FWAdaptive)

/// 当前状态栏布局高度,导航栏隐藏时为0,推荐使用
@property (nonatomic, assign, readonly) CGFloat fw_statusBarHeight NS_REFINED_FOR_SWIFT;

/// 当前导航栏布局高度,隐藏时为0,推荐使用
@property (nonatomic, assign, readonly) CGFloat fw_navigationBarHeight NS_REFINED_FOR_SWIFT;

/// 当前顶部栏布局高度,导航栏隐藏时为0,推荐使用
@property (nonatomic, assign, readonly) CGFloat fw_topBarHeight NS_REFINED_FOR_SWIFT;

/// 当前标签栏布局高度,隐藏时为0,推荐使用
@property (nonatomic, assign, readonly) CGFloat fw_tabBarHeight NS_REFINED_FOR_SWIFT;

/// 当前工具栏布局高度,隐藏时为0,推荐使用
@property (nonatomic, assign, readonly) CGFloat fw_toolBarHeight NS_REFINED_FOR_SWIFT;

/// 当前底部栏布局高度,包含标签栏和工具栏,隐藏时为0,推荐使用
@property (nonatomic, assign, readonly) CGFloat fw_bottomBarHeight NS_REFINED_FOR_SWIFT;

@end

Undocumented

  • 当前状态栏布局高度,导航栏隐藏时为0,推荐使用

    Declaration

    Objective-C

    @property (nonatomic, readonly) CGFloat fw_statusBarHeight;
  • 当前导航栏布局高度,隐藏时为0,推荐使用

    Declaration

    Objective-C

    @property (nonatomic, readonly) CGFloat fw_navigationBarHeight;
  • 当前顶部栏布局高度,导航栏隐藏时为0,推荐使用

    Declaration

    Objective-C

    @property (nonatomic, readonly) CGFloat fw_topBarHeight;
  • 当前标签栏布局高度,隐藏时为0,推荐使用

    Declaration

    Objective-C

    @property (nonatomic, readonly) CGFloat fw_tabBarHeight;
  • 当前工具栏布局高度,隐藏时为0,推荐使用

    Declaration

    Objective-C

    @property (nonatomic, readonly) CGFloat fw_toolBarHeight;
  • 当前底部栏布局高度,包含标签栏和工具栏,隐藏时为0,推荐使用

    Declaration

    Objective-C

    @property (nonatomic, readonly) CGFloat fw_bottomBarHeight;

UIViewController+FWAlertPlugin

  • 自定义弹窗插件,未设置时自动从插件池加载

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) id<FWAlertPlugin> fw_alertPlugin;
  • 显示警告框(精简版),默认关闭按钮

    Declaration

    Objective-C

    - (void)fw_showAlertWithTitle:(nullable id)title message:(nullable id)message;

    Parameters

    title

    警告框标题

    message

    警告框消息

  • 显示警告框(简单版)

    Declaration

    Objective-C

    - (void)fw_showAlertWithTitle:(nullable id)title
                          message:(nullable id)message
                           cancel:(nullable id)cancel
                      cancelBlock:(nullable void (^)(void))cancelBlock;

    Parameters

    title

    警告框标题

    message

    警告框消息

    cancel

    取消按钮标题,默认关闭

    cancelBlock

    取消按钮事件

  • 显示警告框(详细版)

    Declaration

    Objective-C

    - (void)fw_showAlertWithTitle:(nullable id)title
                          message:(nullable id)message
                            style:(FWAlertStyle)style
                           cancel:(nullable id)cancel
                          actions:(nullable NSArray *)actions
                      actionBlock:(nullable void (^)(NSInteger))actionBlock
                      cancelBlock:(nullable void (^)(void))cancelBlock;

    Parameters

    title

    警告框标题

    message

    警告框消息

    style

    警告框样式

    cancel

    取消按钮标题,默认单按钮关闭,多按钮取消

    actions

    动作按钮标题列表

    actionBlock

    动作按钮点击事件,参数为索引index

    cancelBlock

    取消按钮事件

  • 显示确认框(简单版)

    Declaration

    Objective-C

    - (void)fw_showConfirmWithTitle:(nullable id)title
                            message:(nullable id)message
                             cancel:(nullable id)cancel
                            confirm:(nullable id)confirm
                       confirmBlock:(nullable void (^)(void))confirmBlock;

    Parameters

    title

    确认框标题

    message

    确认框消息

    cancel

    取消按钮文字,默认取消

    confirm

    确认按钮文字,默认确定

    confirmBlock

    确认按钮事件

  • 显示确认框(详细版)

    Declaration

    Objective-C

    - (void)fw_showConfirmWithTitle:(nullable id)title
                            message:(nullable id)message
                             cancel:(nullable id)cancel
                            confirm:(nullable id)confirm
                       confirmBlock:(nullable void (^)(void))confirmBlock
                        cancelBlock:(nullable void (^)(void))cancelBlock;

    Parameters

    title

    确认框标题

    message

    确认框消息

    cancel

    取消按钮文字,默认取消

    confirm

    确认按钮文字,默认确定

    confirmBlock

    确认按钮事件

    cancelBlock

    取消按钮事件

  • 显示输入框(简单版)

    Declaration

    Objective-C

    - (void)fw_showPromptWithTitle:(nullable id)title
                           message:(nullable id)message
                            cancel:(nullable id)cancel
                           confirm:(nullable id)confirm
                      confirmBlock:(nullable void (^)(NSString *_Nonnull __strong))
                                       confirmBlock;

    Parameters

    title

    输入框标题

    message

    输入框消息

    cancel

    取消按钮文字,默认取消

    confirm

    确认按钮文字,默认确定

    confirmBlock

    确认按钮事件,参数为输入值

  • 显示输入框(详细版)

    Declaration

    Objective-C

    - (void)fw_showPromptWithTitle:(nullable id)title
                           message:(nullable id)message
                            cancel:(nullable id)cancel
                           confirm:(nullable id)confirm
                       promptBlock:(nullable void (^)(
                                       UITextField *_Nonnull __strong))promptBlock
                      confirmBlock:(nullable void (^)(NSString *_Nonnull __strong))
                                       confirmBlock
                       cancelBlock:(nullable void (^)(void))cancelBlock;

    Parameters

    title

    输入框标题

    message

    输入框消息

    cancel

    取消按钮文字,默认取消

    confirm

    确认按钮文字,默认确定

    promptBlock

    输入框初始化事件,参数为输入框

    confirmBlock

    确认按钮事件,参数为输入值

    cancelBlock

    取消按钮事件

  • 显示输入框(复杂版)

    Declaration

    Objective-C

    - (void)
        fw_showPromptWithTitle:(nullable id)title
                       message:(nullable id)message
                        cancel:(nullable id)cancel
                       confirm:(nullable id)confirm
                   promptCount:(NSInteger)promptCount
                   promptBlock:(nullable void (^)(UITextField *_Nonnull __strong,
                                                  NSInteger))promptBlock
                  confirmBlock:
                      (nullable void (^)(NSArray<NSString *> *_Nonnull __strong))
                          confirmBlock
                   cancelBlock:(nullable void (^)(void))cancelBlock;

    Parameters

    title

    输入框标题

    message

    输入框消息

    cancel

    取消按钮文字,默认取消

    confirm

    确认按钮文字,默认确定

    promptCount

    输入框数量

    promptBlock

    输入框初始化事件,参数为输入框和索引index

    confirmBlock

    确认按钮事件,参数为输入值数组

    cancelBlock

    取消按钮事件

  • 显示弹出框(完整版)

    Declaration

    Objective-C

    - (void)fw_showAlertWithTitle:(nullable id)title
                          message:(nullable id)message
                            style:(FWAlertStyle)style
                           cancel:(nullable id)cancel
                          actions:(nullable NSArray *)actions
                      promptCount:(NSInteger)promptCount
                      promptBlock:(nullable void (^)(UITextField *_Nonnull __strong,
                                                     NSInteger))promptBlock
                      actionBlock:
                          (nullable void (^)(NSArray<NSString *> *_Nonnull __strong,
                                             NSInteger))actionBlock
                      cancelBlock:(nullable void (^)(void))cancelBlock
                      customBlock:
                          (nullable void (^)(id _Nonnull __strong))customBlock;

    Parameters

    title

    操作表标题

    message

    操作表消息

    style

    警告框样式

    cancel

    取消按钮标题,默认Alert单按钮关闭,Alert多按钮取消

    actions

    动作按钮标题列表

    promptCount

    输入框数量

    promptBlock

    输入框初始化事件,参数为输入框和索引index

    actionBlock

    动作按钮点击事件,参数为输入值数组和索引index

    cancelBlock

    取消按钮事件

    customBlock

    自定义弹出框事件

  • 显示操作表(无动作)

    Declaration

    Objective-C

    - (void)fw_showSheetWithTitle:(nullable id)title
                          message:(nullable id)message
                           cancel:(nullable id)cancel
                      cancelBlock:(nullable void (^)(void))cancelBlock;

    Parameters

    title

    操作表标题

    message

    操作表消息

    cancel

    取消按钮标题,默认取消

    cancelBlock

    取消按钮事件

  • 显示操作表(简单版)

    Declaration

    Objective-C

    - (void)fw_showSheetWithTitle:(nullable id)title
                          message:(nullable id)message
                           cancel:(nullable id)cancel
                          actions:(nullable NSArray *)actions
                      actionBlock:(nullable void (^)(NSInteger))actionBlock;

    Parameters

    title

    操作表标题

    message

    操作表消息

    cancel

    取消按钮标题,默认取消

    actions

    动作按钮标题列表

    actionBlock

    动作按钮点击事件,参数为索引index

  • 显示操作表(详细版)

    Declaration

    Objective-C

    - (void)fw_showSheetWithTitle:(nullable id)title
                          message:(nullable id)message
                           cancel:(nullable id)cancel
                          actions:(nullable NSArray *)actions
                     currentIndex:(NSInteger)currentIndex
                      actionBlock:(nullable void (^)(NSInteger))actionBlock
                      cancelBlock:(nullable void (^)(void))cancelBlock;

    Parameters

    title

    操作表标题

    message

    操作表消息

    cancel

    取消按钮标题,默认取消

    actions

    动作按钮标题列表

    currentIndex

    当前选中动作索引

    actionBlock

    动作按钮点击事件,参数为索引index

    cancelBlock

    取消按钮事件

  • 显示操作表(完整版)

    Declaration

    Objective-C

    - (void)fw_showSheetWithTitle:(nullable id)title
                          message:(nullable id)message
                           cancel:(nullable id)cancel
                          actions:(nullable NSArray *)actions
                     currentIndex:(NSInteger)currentIndex
                      actionBlock:(nullable void (^)(NSInteger))actionBlock
                      cancelBlock:(nullable void (^)(void))cancelBlock
                      customBlock:
                          (nullable void (^)(id _Nonnull __strong))customBlock;

    Parameters

    title

    操作表标题

    message

    操作表消息

    cancel

    取消按钮标题,默认Alert单按钮关闭,Alert多按钮或Sheet取消

    actions

    动作按钮标题列表

    currentIndex

    当前选中动作索引

    actionBlock

    动作按钮点击事件,参数为输入值数组和索引index

    cancelBlock

    取消按钮事件

    customBlock

    自定义弹出框事件

  • 手工隐藏弹出框,完成后回调

    Declaration

    Objective-C

    - (void)fw_hideAlert:(BOOL)animated
              completion:(nullable void (^)(void))completion;

    Parameters

    animated

    是否执行动画

    completion

    完成回调

  • 判断是否正在显示弹出框

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL fw_isShowingAlert;

UIViewController+FWBlock

  • 快捷设置导航栏标题

    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 __strong))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 __strong))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 __strong))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 __strong))block;

UIViewController+FWEmptyPlugin

  • 设置空界面外间距,默认zero

    Declaration

    Objective-C

    @property (nonatomic) UIEdgeInsets fw_emptyInsets;
  • 是否显示空界面

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL fw_hasEmptyView;
  • 显示空界面

    Declaration

    Objective-C

    - (void)fw_showEmptyView;
  • 显示空界面加载视图

    Declaration

    Objective-C

    - (void)fw_showEmptyViewLoading;
  • 显示空界面,指定文本

    Declaration

    Objective-C

    - (void)fw_showEmptyViewWithText:(nullable NSString *)text;
  • 显示空界面,指定文本和详细文本

    Declaration

    Objective-C

    - (void)fw_showEmptyViewWithText:(nullable NSString *)text
                              detail:(nullable NSString *)detail;
  • 显示空界面,指定文本、详细文本和图片

    Declaration

    Objective-C

    - (void)fw_showEmptyViewWithText:(nullable NSString *)text
                              detail:(nullable NSString *)detail
                               image:(nullable UIImage *)image;
  • 显示空界面,指定文本、详细文本、图片和动作按钮

    Declaration

    Objective-C

    - (void)fw_showEmptyViewWithText:(nullable NSString *)text
                              detail:(nullable NSString *)detail
                               image:(nullable UIImage *)image
                              action:(nullable NSString *)action
                               block:(nullable void (^)(id _Nonnull __strong))block;
  • 显示空界面,指定文本、详细文本、图片、是否显示加载视图和动作按钮

    Declaration

    Objective-C

    - (void)fw_showEmptyViewWithText:(nullable NSString *)text
                              detail:(nullable NSString *)detail
                               image:(nullable UIImage *)image
                             loading:(BOOL)loading
                              action:(nullable NSString *)action
                               block:(nullable void (^)(id _Nonnull __strong))block;
  • 显示空界面,指定文本、详细文本、图片、是否显示加载视图和最多两个动作按钮

    Declaration

    Objective-C

    - (void)fw_showEmptyViewWithText:(nullable NSString *)text
                              detail:(nullable NSString *)detail
                               image:(nullable UIImage *)image
                             loading:(BOOL)loading
                             actions:(nullable NSArray<NSString *> *)actions
                               block:(nullable void (^)(NSInteger,
                                                        id _Nonnull __strong))block;
  • 隐藏空界面

    Declaration

    Objective-C

    - (void)fw_hideEmptyView;

UIViewController

  • 自定义图片选取插件,未设置时自动从插件池加载

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) id<FWImagePickerPlugin> fw_imagePickerPlugin;
  • 从Camera选取单张图片(简单版)

    Declaration

    Objective-C

    - (void)fw_showImageCameraWithAllowsEditing:(BOOL)allowsEditing
                                     completion:(nonnull void (^)(
                                                    UIImage *_Nullable __strong,
                                                    BOOL))completion;

    Parameters

    allowsEditing

    是否允许编辑

    completion

    完成回调,主线程。参数1为图片,2为是否取消

  • 从Camera选取单张图片(详细版)

    Declaration

    Objective-C

    - (void)fw_showImageCameraWithFilterType:(FWImagePickerFilterType)filterType
                               allowsEditing:(BOOL)allowsEditing
                                 customBlock:(nullable void (^)(
                                                 id _Nonnull __strong))customBlock
                                  completion:
                                      (nonnull void (^)(id _Nullable __strong,
                                                        id _Nullable __strong,
                                                        BOOL))completion;

    Parameters

    filterType

    过滤类型,默认0同系统

    allowsEditing

    是否允许编辑

    customBlock

    自定义配置句柄,默认nil

    completion

    完成回调,主线程。参数1为对象(UIImage|PHLivePhoto|NSURL),2为结果信息,3为是否取消

  • 从图片库选取单张图片(简单版)

    Declaration

    Objective-C

    - (void)fw_showImagePickerWithAllowsEditing:(BOOL)allowsEditing
                                     completion:(nonnull void (^)(
                                                    UIImage *_Nullable __strong,
                                                    BOOL))completion;

    Parameters

    allowsEditing

    是否允许编辑

    completion

    完成回调,主线程。参数1为图片,2为是否取消

  • 从图片库选取多张图片(简单版)

    Declaration

    Objective-C

    - (void)fw_showImagePickerWithSelectionLimit:(NSInteger)selectionLimit
                                   allowsEditing:(BOOL)allowsEditing
                                      completion:
                                          (nonnull void (^)(
                                              NSArray<UIImage *> *_Nonnull __strong,
                                              NSArray *_Nonnull __strong,
                                              BOOL))completion;

    Parameters

    selectionLimit

    最大选择数量

    allowsEditing

    是否允许编辑

    completion

    完成回调,主线程。参数1为图片数组,2为结果数组,3为是否取消

  • 从图片库选取多张图片(详细版)

    Declaration

    Objective-C

    - (void)fw_showImagePickerWithFilterType:(FWImagePickerFilterType)filterType
                              selectionLimit:(NSInteger)selectionLimit
                               allowsEditing:(BOOL)allowsEditing
                                 customBlock:(nullable void (^)(
                                                 id _Nonnull __strong))customBlock
                                  completion:
                                      (nonnull void (^)(NSArray *_Nonnull __strong,
                                                        NSArray *_Nonnull __strong,
                                                        BOOL))completion;

    Parameters

    filterType

    过滤类型,默认0同系统

    selectionLimit

    最大选择数量

    allowsEditing

    是否允许编辑

    customBlock

    自定义配置句柄,默认nil

    completion

    完成回调,主线程。参数1为对象数组(UIImage|PHLivePhoto|NSURL),2位结果数组,3为是否取消

UIViewController+FWImagePreviewPlugin

  • 自定义图片预览插件,未设置时自动从插件池加载

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) id<FWImagePreviewPlugin> fw_imagePreviewPlugin;
  • 显示图片预览(简单版)

    Declaration

    Objective-C

    - (void)fw_showImagePreviewWithImageURLs:(nonnull NSArray *)imageURLs
                                  imageInfos:(nullable NSArray *)imageInfos
                                currentIndex:(NSInteger)currentIndex
                                  sourceView:(nullable id _Nullable (^)(NSInteger))
                                                 sourceView;

    Parameters

    imageURLs

    预览图片列表,支持NSString|UIImage|PHLivePhoto|AVPlayerItem类型

    imageInfos

    自定义图片信息数组

    currentIndex

    当前索引,默认0

    sourceView

    来源视图,可选,支持UIView|NSValue.CGRect,默认nil

  • 显示图片预览(详细版)

    Declaration

    Objective-C

    - (void)fw_showImagePreviewWithImageURLs:(nonnull NSArray *)imageURLs
                                  imageInfos:(nullable NSArray *)imageInfos
                                currentIndex:(NSInteger)currentIndex
                                  sourceView:(nullable id _Nullable (^)(NSInteger))
                                                 sourceView
                            placeholderImage:(nullable UIImage *_Nullable (^)(
                                                 NSInteger))placeholderImage
                                 renderBlock:(nullable void (^)(
                                                 __kindof UIView *_Nonnull __strong,
                                                 NSInteger))renderBlock
                                 customBlock:(nullable void (^)(
                                                 id _Nonnull __strong))customBlock;

    Parameters

    imageURLs

    预览图片列表,支持NSString|UIImage|PHLivePhoto|AVPlayerItem类型

    imageInfos

    自定义图片信息数组

    currentIndex

    当前索引,默认0

    sourceView

    来源视图句柄,支持UIView|NSValue.CGRect,默认nil

    placeholderImage

    占位图或缩略图句柄,默认nil

    renderBlock

    自定义渲染句柄,默认nil

    customBlock

    自定义句柄,默认nil

UINavigationController+FWBarTransition

  • 转场动画自定义判断标识,不相等才会启用转场。默认nil启用转场。可重写或者push前设置生效

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) id fw_barTransitionIdentifier;
  • 标记转场导航栏样式需要刷新,如果viewDidAppear之前导航栏样式发生了改变,可调用此方法

    Declaration

    Objective-C

    - (void)fw_barTransitionNeedsUpdate;

UINavigationController+FWFullscreenPopGesture

  • 视图控制器是否禁用全屏返回手势,默认NO

    Declaration

    Objective-C

    @property (nonatomic) BOOL fw_fullscreenPopGestureDisabled;
  • 视图控制器全屏手势距离左侧最大距离,默认0,无限制

    Declaration

    Objective-C

    @property (nonatomic) CGFloat fw_fullscreenPopGestureDistance;

UIViewController+FWStyle

  • 状态栏样式,默认UIStatusBarStyleDefault,设置后才会生效

    Declaration

    Objective-C

    @property (nonatomic) UIStatusBarStyle fw_statusBarStyle;
  • 状态栏是否隐藏,默认NO,设置后才会生效

    Declaration

    Objective-C

    @property (nonatomic) BOOL fw_statusBarHidden;
  • 当前导航栏设置,优先级高于style,设置后会在viewWillAppear:自动应用生效

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) FWNavigationBarAppearance *fw_navigationBarAppearance;
  • 当前导航栏样式,默认Default,设置后才会在viewWillAppear:自动应用生效

    Declaration

    Objective-C

    @property (nonatomic) FWNavigationBarStyle fw_navigationBarStyle;
  • 导航栏是否隐藏,默认NO,设置后才会在viewWillAppear:自动应用生效

    Declaration

    Objective-C

    @property (nonatomic) BOOL fw_navigationBarHidden;
  • 动态隐藏导航栏,如果当前已经viewWillAppear:时立即执行

    Declaration

    Objective-C

    - (void)fw_setNavigationBarHidden:(BOOL)hidden animated:(BOOL)animated;
  • 是否允许修改导航栏样式,默认未设置时child控制器不能修改

    Declaration

    Objective-C

    @property (nonatomic) BOOL fw_allowsBarAppearance;
  • 标签栏是否隐藏,默认为NO,立即生效。如果tabBar一直存在,则用tabBar包裹navBar;如果tabBar只存在主界面,则用navBar包裹tabBar

    Declaration

    Objective-C

    @property (nonatomic) BOOL fw_tabBarHidden;
  • 工具栏是否隐藏,默认为YES。需设置toolbarItems,立即生效

    Declaration

    Objective-C

    @property (nonatomic) BOOL fw_toolBarHidden;
  • 动态隐藏工具栏。需设置toolbarItems,立即生效

    Declaration

    Objective-C

    - (void)fw_setToolBarHidden:(BOOL)hidden animated:(BOOL)animated;
  • 设置视图布局Bar延伸类型,None为不延伸(Bar不覆盖视图),Top|Bottom为顶部|底部延伸,All为全部延伸

    Declaration

    Objective-C

    @property (nonatomic) UIRectEdge fw_extendedLayoutEdge;

Navigator

  • 打开控制器。1.如果打开导航栏,则调用present;2.否则如果导航栏存在,则调用push;3.否则调用present

    Declaration

    Objective-C

    - (void)fw_openViewController:(nonnull UIViewController *)viewController
                         animated:(BOOL)animated;
  • 打开控制器。1.如果打开导航栏,则调用present;2.否则如果导航栏存在,则调用push;3.否则调用present,完成时回调

    Declaration

    Objective-C

    - (void)fw_openViewController:(nonnull UIViewController *)viewController
                         animated:(BOOL)animated
                          options:(FWNavigatorOptions)options
                       completion:(nullable void (^)(void))completion;
  • 关闭控制器,返回是否成功。1.如果导航栏不存在,则调用dismiss;2.否则如果已是导航栏底部,则调用dismiss;3.否则调用pop

    Declaration

    Objective-C

    - (BOOL)fw_closeViewControllerAnimated:(BOOL)animated;
  • 关闭控制器,返回是否成功。1.如果导航栏不存在,则调用dismiss;2.否则如果已是导航栏底部,则调用dismiss;3.否则调用pop,完成时回调

    Declaration

    Objective-C

    - (BOOL)fw_closeViewControllerAnimated:(BOOL)animated
                                   options:(FWNavigatorOptions)options
                                completion:(nullable void (^)(void))completion;

Workflow

  • 自定义工作流名称,支持二级(“."分隔);默认返回小写类名(去掉ViewController、Controller)

    Declaration

    Objective-C

    @property (nonatomic, copy) NS_REFINED_FOR_SWIFT NSString *fw_workflowName;

FWToastPlugin

  • 设置吐司是否显示在window上,默认NO,显示到view上

    Declaration

    Objective-C

    @property (nonatomic) BOOL fw_toastInWindow;
  • 设置吐司是否显示在祖先视图上,默认NO,显示到view上

    Declaration

    Objective-C

    @property (nonatomic) BOOL fw_toastInAncestor;
  • 设置吐司外间距,默认zero

    Declaration

    Objective-C

    @property (nonatomic) UIEdgeInsets fw_toastInsets;
  • 显示加载吐司,需手工隐藏,默认文本

    Declaration

    Objective-C

    - (void)fw_showLoading;
  • 显示加载吐司,需手工隐藏,支持String和AttributedString

    Declaration

    Objective-C

    - (void)fw_showLoadingWithText:(nullable id)text;
  • 显示加载吐司,默认需手工隐藏,指定cancelBlock点击时会自动隐藏并调用之,支持String和AttributedString

    Declaration

    Objective-C

    - (void)fw_showLoadingWithText:(nullable id)text
                       cancelBlock:(nullable void (^)(void))cancelBlock;
  • 隐藏加载吐司

    Declaration

    Objective-C

    - (void)fw_hideLoading;
  • 是否正在显示加载吐司

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL fw_isShowingLoading;
  • 显示进度条吐司,需手工隐藏,支持String和AttributedString

    Declaration

    Objective-C

    - (void)fw_showProgressWithText:(nullable id)text progress:(CGFloat)progress;
  • 显示进度条吐司,默认需手工隐藏,指定cancelBlock时点击会自动隐藏并调用之,支持String和AttributedString

    Declaration

    Objective-C

    - (void)fw_showProgressWithText:(nullable id)text
                           progress:(CGFloat)progress
                        cancelBlock:(nullable void (^)(void))cancelBlock;
  • 隐藏进度条吐司

    Declaration

    Objective-C

    - (void)fw_hideProgress;
  • 是否正在显示进度条吐司

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL fw_isShowingProgress;
  • 显示默认样式消息吐司,自动隐藏,支持String和AttributedString

    Declaration

    Objective-C

    - (void)fw_showMessageWithText:(nullable id)text;
  • 显示指定样式消息吐司,自动隐藏,支持String和AttributedString

    Declaration

    Objective-C

    - (void)fw_showMessageWithText:(nullable id)text style:(FWToastStyle)style;
  • 显示指定样式消息吐司,自动隐藏,自动隐藏完成后回调,支持String和AttributedString

    Declaration

    Objective-C

    - (void)fw_showMessageWithText:(nullable id)text
                             style:(FWToastStyle)style
                        completion:(nullable void (^)(void))completion;
  • 显示指定样式消息吐司,可设置自动隐藏和允许交互,自动隐藏完成后回调,支持String和AttributedString

    Declaration

    Objective-C

    - (void)fw_showMessageWithText:(nullable id)text
                             style:(FWToastStyle)style
                          autoHide:(BOOL)autoHide
                       interactive:(BOOL)interactive
                        completion:(nullable void (^)(void))completion;
  • 隐藏消息吐司

    Declaration

    Objective-C

    - (void)fw_hideMessage;
  • 是否正在显示消息吐司

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL fw_isShowingMessage;

UIViewController+FWToolkit

  • 当前生命周期状态,默认Ready

    Declaration

    Objective-C

    @property (nonatomic, readonly) FWViewControllerVisibleState fw_visibleState;
  • 生命周期变化时通知句柄,默认nil

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) void (^) (__kindof UIViewController *_Nonnull __strong, FWViewControllerVisibleState) fw_visibleStateChanged;
  • 自定义完成结果对象,默认nil

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) id fw_completionResult;
  • 自定义完成句柄,默认nil,dealloc时自动调用,参数为fwCompletionResult。支持提前调用,调用后需置为nil

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) void (^)(id _Nullable __strong) fw_completionHandler;
  • 自定义侧滑返回手势VC开关句柄,enablePopProxy启用后生效,仅处理边缘返回手势,优先级低,默认nil

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) BOOL (^)(void) fw_allowsPopGesture;
  • 自定义控制器返回VC开关句柄,enablePopProxy启用后生效,统一处理返回按钮点击和边缘返回手势,优先级高,默认nil

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) BOOL (^)(void) fw_shouldPopController;
  • 自定义侧滑返回手势VC开关,enablePopProxy启用后生效,仅处理边缘返回手势,优先级低,自动调用fw.allowsPopGesture,默认YES

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL allowsPopGesture;
  • 自定义控制器返回VC开关,enablePopProxy启用后生效,统一处理返回按钮点击和边缘返回手势,优先级高,自动调用fw.shouldPopController,默认YES

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL shouldPopController;

UIViewController+FWUIKit

  • 判断当前控制器是否是根控制器。如果是导航栏的第一个控制器或者不含有导航栏,则返回YES

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL fw_isRoot;
  • 判断当前控制器是否是子控制器。如果父控制器存在,且不是导航栏或标签栏控制器,则返回YES

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL fw_isChild;
  • 判断当前控制器是否是present弹出。如果是导航栏的第一个控制器且导航栏是present弹出,也返回YES

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL fw_isPresented;
  • 判断当前控制器是否是iOS13+默认pageSheet弹出样式。该样式下导航栏高度等与默认样式不同

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL fw_isPageSheet;
  • 视图是否可见,viewWillAppear后为YES,viewDidDisappear后为NO

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL fw_isViewVisible;
  • 获取祖先视图,标签栏存在时为标签栏根视图,导航栏存在时为导航栏根视图,否则为控制器根视图

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) NS_REFINED_FOR_SWIFT UIView *fw_ancestorView;
  • 是否已经加载完数据,默认NO,加载数据完成后可标记为YES,可用于第一次加载时显示loading等判断

    Declaration

    Objective-C

    @property (nonatomic) BOOL fw_isDataLoaded;
  • 添加子控制器到当前视图,解决不能触发viewWillAppear等的bug

    Declaration

    Objective-C

    - (void)fw_addChildViewController:(nonnull UIViewController *)viewController;
  • 添加子控制器到指定视图,可自定义布局,解决不能触发viewWillAppear等的bug

    Declaration

    Objective-C

    - (void)fw_addChildViewController:(nonnull UIViewController *)viewController
                               inView:(nullable UIView *)view
                               layout:(nullable void (^)(UIView *_Nonnull __strong))
                                          layout;
  • 移除子控制器,解决不能触发viewWillAppear等的bug

    Declaration

    Objective-C

    - (void)fw_removeChildViewController:(nonnull UIViewController *)viewController;

UIViewController+FWTransition

  • 视图控制器present|dismiss转场。注意会修改transitioningDelegate,且会强引用之;如需weak引用,请直接设置transitioningDelegate

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) FWAnimatedTransition *fw_modalTransition;
  • 视图控制器push|pop转场,代理导航控制器转场,需在fwNavigationTransition设置后生效

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) FWAnimatedTransition *fw_viewTransition;
  • 自定义控制器present系统转场(蒙层渐变,内容向上动画),会设置fwModalTransition

    Declaration

    Objective-C

    - (nonnull FWAnimatedTransition *)fw_setPresentTransition:
        (nullable void (^)(FWPresentationController *_Nonnull __strong))
            presentationBlock;
  • 自定义控制器alert缩放转场(蒙层渐变,内容缩放动画),会设置fwModalTransition

    Declaration

    Objective-C

    - (nonnull FWAnimatedTransition *)fw_setAlertTransition:
        (nullable void (^)(FWPresentationController *_Nonnull __strong))
            presentationBlock;
  • 自定义控制器fade渐变转场(蒙层和内容渐变动画),会设置fwModalTransition;

    Declaration

    Objective-C

    - (nonnull FWAnimatedTransition *)fw_setFadeTransition:
        (nullable void (^)(FWPresentationController *_Nonnull __strong))
            presentationBlock;
  • 设置iOS13默认present手势下拉dismiss时的回调block,仅iOS13生效,自动触发,手工dismiss不会触发。会自动设置presentationController.delegate

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) void (^)(void) fw_presentationDidDismiss;
  • 自定义控制器popover弹出效果(preferredContentSize设置大小),会自动设置modalPresentationStyle和popoverPresentationController.delegate

    Declaration

    Objective-C

    - (void)fw_setPopoverPresentation:
                (void (^_Nullable __strong)(
                    UIPopoverPresentationController *_Nonnull __strong))
                    presentationBlock
                        shouldDismiss:(BOOL)shouldDismiss;