Classes
The following classes are available globally.
-
Undocumented
See moreDeclaration
Objective-C
@interface QMUINavigationController : UINavigationController /** * 初始化时调用的方法,会在 initWithNibName:bundle: 和 initWithCoder: 这两个指定的初始化方法中被调用,所以子类如果需要同时支持两个初始化方法,则建议把初始化时要做的事情放到这个方法里。否则仅需重写要支持的那个初始化方法即可。 */ - (void)didInitialize NS_REQUIRES_SUPER; @end
Swift
class QMUINavigationController : UINavigationController
-
可作为项目内所有
UITableViewController
的基类,注意是继承自QMUICommonViewController
而不是UITableViewController
。一般通过
initWithStyle:
方法初始化,对于要生成UITableViewStylePlain
类型的列表,推荐使用init:
方法。提供的功能包括:
- 集成
QMUISearchController
,可通过属性shouldShowSearchBar
来快速为列表生成一个 searchBar 及 searchController,具体请查看 QMUICommonTableViewController (Search)。 - 支持仅设置 tableView:titleForHeaderInSection: 就能自动生成 sectionHeader,无需编写 viewForHeaderInSection:、heightForHeaderInSection: 等方法。
- 自带一个 QMUIEmptyView,作为 tableView 的 subview,可用于显示 loading、空或错误提示语等。
Note
emptyView 会从 tableHeaderView 的下方开始布局到 tableView 最底部,因此它会遮挡 tableHeaderView 之外的部分(比如 tableFooterView 和 cells ),你可以重写 layoutEmptyView 来改变这个布局方式
See
QMUISearchController
Declaration
Objective-C
@interface QMUICommonTableViewController : QMUICommonViewController
Swift
class QMUICommonTableViewController : QMUICommonViewController
- 集成
-
可作为项目内所有
UIViewController
的基类,提供的功能包括:自带顶部标题控件
QMUINavigationTitleView
,支持loading、副标题、下拉菜单,设置标题依然使用系统的setTitle:
方法自带空界面控件
QMUIEmptyView
,支持显示loading、空文案、操作按钮统一约定的常用接口,例如初始化 subview、设置顶部
navigationItem
、底部toolbarItem
、响应系统的动态字体大小变化、…,从而保证相同类型的代码集中到同一个方法内,避免多人交叉维护时代码分散难以查找配合
QMUINavigationController
使用时,可以得到willPopInNavigationControllerWithAnimated:
、didPopInNavigationControllerWithAnimated:
这两个时机
See
QMUINavigationTitleViewSee
QMUIEmptyViewDeclaration
Objective-C
@interface QMUICommonViewController : UIViewController { QMUIEmptyView *_emptyView; }
Swift
class QMUICommonViewController : UIViewController
-
建议作为项目里 tabBarController 的基类,内部处理了几件事情:
- 配合配置表修改 tabBar 的样式。
- 管理界面支持显示的方向。
Warning
当你需要实现“tabBarController 首页那几个界面显示 tabBar,而 push 进去的所有子界面都隐藏 tabBar”的效果时,可将配置表里的 HidesBottomBarWhenPushedInitially 改为 YES,然后手动将 tabBarController 首页的那几个界面的 hidesBottomBarWhenPushed 属性改为 NO,即可实现。Inherent your tabBarController from this, so you can enjoy:
- a tabBar with styles defined in configuration templates
- a tabBar that manages supported interface orientations
Declaration
Objective-C
@interface QMUITabBarViewController : UITabBarController
Swift
class QMUITabBarViewController : UITabBarController