//TabBarController协议
@interfaceAppDelegate()
//自定义TabBar时
myTabBarController* myTabBarController1 = [[myTabBarControlleralloc]initWithArray:@[@"微信",@"微博",@"网易"]];
//将视图控制器添加给TabBarController
[myTabBarController1addChildViewController:rootVC];
[myTabBarController1addChildViewController:sec];
[myTabBarController1addChildViewController:third];
或
myTabBarController1 .viewControllers=@[rootVC,sec,third];
//设置右上角提示信息
nav3.tabBarItem.badgeValue=@"100";
//设置本选中的tabBarItem下标(默认显示第一个)
tabBarController.selectedIndex=0;
//修改渲染颜色
tabBarController.tabBar.tintColor= [UIColorredColor];
/*
UIApperarance:外观控制:
*/
//UIBarStyleBlack白色
// [[UINavigationBar appearance] setBarTintColor:[UIColor cyanColor]];
[[UINavigationBarappearance]setBarStyle:(UIBarStyleBlack)];
[[UINavigationBarappearance]setTranslucent:NO];
[[UITabBarappearance]setBackgroundImage:[UIImageimageNamed:@"backImage@2x"]];
//修改所有导航栏标题颜色
[[UINavigationBarappearance]setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColorredColor]}];
//清扫时隐藏navigationBar
self.navigationController.hidesBarsOnSwipe=YES;
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent*)event{
FiveViewController* five = [[FiveViewControlleralloc]init];
//在推出新的界面时隐藏tabBar
five.hidesBottomBarWhenPushed=YES;
[self.navigationControllerpushViewController:fiveanimated:YES];
[fiverelease];
}
//将status bar 文本颜色设置为白色
self.navigationController.navigationBar.barStyle=UIBarStyleBlack;
//将status bar 文本颜色设置为黑色 ,默认就是黑色
self.navigationController.navigationBar.barStyle=UIBarStyleDefault;
全局改变status bar样式
info.plist
网友评论