KLProjectRoot
pod 'KLProjectRoot'
安装 或者,将项目中的 KLProjectRoot/KLProjectRoot 文件夹下的所有文件复制到您的项目
使用
- 1 导入
#import "KLProjectRootHeader.h"
- 2 可以直接使用 TabBarController 和 NavigationController,也可以继承后使用。根据项目情况,推荐继承后使用。
KLTabBarController
可以创建普通的 TabBarController,也可以创建带有异形按钮的 TabBarController
-
如果需要创建带有异形按钮的 TabBarController,则需要设置
-
isLoadCustemButton
是否加载中间的异形按钮,类似于微博早些时候版本的发布微博按钮 -
tabBarCustemButton
tabBar 的异形按钮 -
遵循代理
KLTabBarControllerDelegate
- (instancetype)init { self = [super init]; if (self) { self.isLoadCustemButton = YES; UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; [button setImage:[UIImage imageNamed:@"cts_tabbar_add_selIcon"] forState:UIControlStateNormal]; self.tabBarCustemButton = button; } return self; }
-
-
其他属性
titleColor
普通状态下每个 item 的 title 颜色selctedTitleColor
选中状态下每个 item 的 title 颜色navigationControllerClass
给子控制器模拟导航控制器的类
-
其他方法
-
添加子控制器 并选择是否为子控制器包裹导航
@param childController 子控制器的实例 @param title title @param imageName 普通状态下图标icon的imageName @param selectedImageName 选中状态下图标icon的imageName @param isLoad 是否为子控制器加载导航 - (void)addChildViewController:(UIViewController *)childController title:(NSString *)title imageName:(NSString *)imageName selectedImageName:(NSString *)selectedImageName isLoadNavigation:(BOOL)isLoad;
-
添加子控制器,并为子控制器包裹导航
@param childController 子控制器的实例 @param title title @param imageName 普通状态下图标icon的imageName @param selectedImageName 选中状态下图标icon的imageName - (void)addChildViewController:(UIViewController *)childController title:(NSString *)title imageName:(NSString *)imageName selectedImageName:(NSString *)selectedImageName
-
KLNavigationController
- 属性
backImageName
返回按钮的 icon 图片名translucent
效果等同于设置 UINavigationBar 的 translucent 属性navigationBarTintColor
效果等同于设置 UINavigationBar 的 tint_color 属性 同时会默认设置 translucent 为 falsenavigationBarBackgroundImage
效果等同于设置 UINavigationBar 的 setBackgroundImage 方法showShadow
是否显示 navigationBar 下方的阴影条,默认不显示
KLNavigationTitleLabel
设置导航栏的 title,通过一个 KLNavigationTitleLabel 实例,设置导航的 titleView
self.navigationItem.titleView = [KLNavigationTitleLabel navigationTitleLabel:@"title"];
配置文件 NavigationTitleConfig
设置 KLNavigationTitleLabel 的字体颜色
-
设置导航 titleLabel 的字体颜色,默认为白色
@param color 颜色 void ConfigNavigationTitleColor(UIColor *color)
-
获取导航.titleLabel 的字体颜色
UIColor *NavigationTitleColor(void)