DKTabView
示例
使用方法
要运行示例项目,请克隆仓库,然后首先从 Example 目录运行 pod install
命令。
以下是如何创建自定义标签视图。
DKTabView *tabView = [[DKTabView alloc] initWithFrame:CGRectMake(0, 120, CGRectGetWidth(self.view.frame), 44)];
tabView.layoutStyle = DKTabFillParent;
tabView.cursorStyle = DKTabCursorUnderneath;
tabView.backgroundColor = [UIColor whiteColor];
tabView.cursorView.backgroundColor = [UIColor blackColor];
// This method should be invoked at the last step
[tabView buildTabViewWithItems:^NSArray * {
NSArray * titles = @[@"NEWS", @"CULTURE", @"BOOKS", @"BUSINESS"];
NSMutableArray *items = [[NSMutableArray alloc] init];
for (NSString *title in titles) {
UILabel *label = [[UILabel alloc] init];
label.text = title;
label.font = [UIFont systemFontOfSize:14];
label.textColor = [UIColor blackColor];
label.textAlignment = NSTextAlignmentCenter;
[items addObject:label];
}
return items;
}];
[self.view addSubview:tabView];
安装
DKTabView 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中
pod "DKTabView"
作者
drinking,[email protected]
许可
DKTabView可在MIT许可证下使用。有关更多信息,请参阅LICENSE文件。