DKTabPageViewController是一个UIViewController的子类,其基于Child ViewController管理多个页面,支持手动滚动,以及是否显示顶部的Tab等。每一个Tab对应一个UIViewController实例,与其他的Tab相互独立,View支持懒加载及viewWillAppear、viewWillDisappear等方法。
简单的接口:
@property (nonatomic, assign) NSInteger selectedIndex;
@property (nonatomic, readonly) UIViewController *selectedViewController;
/**
* Whether show the Tab Bar. Defaults to YES.
*/
@property (nonatomic, assign) BOOL showTabPageBar;
/**
* Whether allow scroll gestures. Defaults to YES.
*/
@property (nonatomic, assign) BOOL gestureScrollEnabled;
/**
* The block to be executed on the page changed.
*/
@property (nonatomic, copy) void (^pageChangedBlock)(NSInteger selectedIndex);
可定制的DKTabPageBar:
@interface DKTabPageBar : UIView
/**
* Height of the tab bar. Defautls to 40.
*/
@property (nonatomic, assign) CGFloat tabBarHeight UI_APPEARANCE_SELECTOR;
/**
* Font of the tab bar. Defautls to [UIFont systemFontOfSize:14].
*/
@property (nonatomic, strong) UIFont *titleFont UI_APPEARANCE_SELECTOR;
/**
* The selection indicator is draw on bottom of the tab bar.
*/
@property (nonatomic, strong) UIView *selectionIndicatorView;
@property(nonatomic, copy) UIColor *backgroundColor UI_APPEARANCE_SELECTOR;
@end