TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2016 |
Maintained by bingozb.
A dankal viewPage to imitate android for iOS.
pod 'DKViewPage'
Clone or download
,将DKViewPage
文件夹整个拖到你的项目中#import "DKViewPage.h"
DKViewPageOption
对象数组// title:标签栏上的文字
// viewController:对应页的控制器
DKViewPageOption *option1 = [[DKViewPageOption alloc] initWithTitle:@"normal" viewController:[[DKDemoNormalViewController alloc] init]];
DKViewPageOption *option2 = [[DKViewPageOption alloc] initWithTitle:@"scroll" viewController:[[DKDemoScrollViewController alloc] init]];
DKViewPageOption *option3 = [[DKViewPageOption alloc] initWithTitle:@"table" viewController:[[DKDemoTableViewController alloc] init]];
NSArray<DKViewPageOption *> *options = @[option1,option2,option3];
self.options = options;
DKViewPage *viewPage = [[DKViewPage alloc] initWithFrame:self.view.bounds options:self.options];
viewPage.dk_y = 64;
self.viewPage = viewPage;
[self.view addSubview:viewPage];
/** 标题栏的frame */
@property (nonatomic, assign) CGRect titleViewFrame;
/** 所有控制器view的frame */
@property (nonatomic, assign) CGRect controllerViewFrame;
/** 标题栏字体 */
@property (nonatomic, weak) UIFont *titleFont;
/** 标题栏字体普通状态颜色 */
@property (nonatomic, weak) UIColor *titleNormalColor;
/** 标题栏字体选中状态颜色 */
@property (nonatomic, weak) UIColor *titleSelectedColor;
/** 标题栏背景颜色 */
@property (nonatomic, weak) UIColor *titleViewBackgroundColor;
/** 标题栏底部指示器颜色 */
@property (nonatomic, weak) UIColor *indicatorColor;
/** 标题栏底部指示器高度 */
@property (nonatomic, assign) CGFloat indicatorHeight;
// 监听通知
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refreshSomething) name:DKTitleButtonDidRepeatClickNotification object:nil];
- (void)refreshSomething
{
// do something…
}
#define kViewPageScrollUnEnableTag 1000
// 将需要接收事件Events传递的控件的tag设为1000即可。