您的位置:首页 > 产品设计 > UI/UE

UI课程14 标签视图控制器 UITabBarController

2015-10-04 21:27 603 查看
1.UITabBarController的结构

三层结构:TabBar,Custom Content,Tab bar controlelr view



2.相关属性的设置

//准备视图控制器数组
NSArray *array = @[redNC,orangeNC,yellowNC,greenNC,cyanNC,blueNC,purpleNC];

//创建tabBarController
UITabBarController *tabBC = [UITabBarController new];

//设定子视图控制器
tabBC.viewControllers = array;

//设置整个 tabBar 的颜色
//    tabBC.tabBar.barTintColor = [UIColor lightGrayColor];

//tabBar高度49

//tabBar 样式
//    tabBC.tabBar.barStyle = UIBarStyleBlack; //透明

//给tabBar设置背景图片
tabBC.tabBar.backgroundImage = [UIImage imageNamed:@"image"];

//设置标题颜色(着色,字体颜色)
tabBC.tabBar.tintColor = [UIColor magentaColor];

//设置选中下标
tabBC.selectedIndex = 2;

//设置bageValue
redVC.tabBarItem.badgeValue = @"99+";

//设置代理对象
tabBC.delegate = self;

//统一修改(一键换肤)
[[UINavigationBar appearance] setBarTintColor:[UIColor magentaColor]];

//指定为根视图控制器
[self.window setRootViewController:tabBC];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: