UITabBarController和UINavigationController搭配使用
2016-08-05 14:52
453 查看
self.window = [[UIWindow
alloc]initWithFrame:[UIScreen
mainScreen].bounds];
ViewController *vc = [[ViewController
alloc]init];
UINavigationController *nvc = [[UINavigationController
alloc]initWithRootViewController:vc];
[vc.navigationItem
setTitle:@"第一页"];
[vc.tabBarItem
setTitle:@"Message"];
[vc.tabBarItem
setImage:[UIImage
imageNamed:@"message.png"]];
[vc.tabBarItem
setBadgeValue:@"99+"];
//设置字体颜色
[vc.tabBarItem
setTitleTextAttributes:@{NSFontAttributeName:[UIFont
systemFontOfSize:20],NSForegroundColorAttributeName:[UIColor
whiteColor]}
forState:UIControlStateNormal];
[vc.tabBarItem
setTitleTextAttributes:@{NSFontAttributeName:[UIFont
systemFontOfSize:20],NSForegroundColorAttributeName:[UIColor
blackColor]}
forState:UIControlStateHighlighted];
[vc.view
setBackgroundColor:[UIColor
blueColor]];
SecondViewController *svc = [[SecondViewController
alloc]init];
UINavigationController *snvc = [[UINavigationController
alloc]initWithRootViewController:svc];
[svc.navigationItem
setTitle:@"第一页"];
[svc.tabBarItem
setTitle:@"Setting"];
[svc.tabBarItem
setImage:[UIImage
imageNamed:@"setting.png"]];
[svc.tabBarItem
setBadgeValue:@"999+"];
[svc.view
setBackgroundColor:[UIColor
yellowColor]];
UITabBarController *tb = [[UITabBarController
alloc]init];
tb.viewControllers =
@[nvc,snvc];
[tb.tabBar
setTintColor:[UIColor
redColor]];
[tb.tabBar
setBarTintColor:[UIColor
orangeColor]];
[self.window
setRootViewController:tb];
[self.window
makeKeyAndVisible];
alloc]initWithFrame:[UIScreen
mainScreen].bounds];
ViewController *vc = [[ViewController
alloc]init];
UINavigationController *nvc = [[UINavigationController
alloc]initWithRootViewController:vc];
[vc.navigationItem
setTitle:@"第一页"];
[vc.tabBarItem
setTitle:@"Message"];
[vc.tabBarItem
setImage:[UIImage
imageNamed:@"message.png"]];
[vc.tabBarItem
setBadgeValue:@"99+"];
//设置字体颜色
[vc.tabBarItem
setTitleTextAttributes:@{NSFontAttributeName:[UIFont
systemFontOfSize:20],NSForegroundColorAttributeName:[UIColor
whiteColor]}
forState:UIControlStateNormal];
[vc.tabBarItem
setTitleTextAttributes:@{NSFontAttributeName:[UIFont
systemFontOfSize:20],NSForegroundColorAttributeName:[UIColor
blackColor]}
forState:UIControlStateHighlighted];
[vc.view
setBackgroundColor:[UIColor
blueColor]];
SecondViewController *svc = [[SecondViewController
alloc]init];
UINavigationController *snvc = [[UINavigationController
alloc]initWithRootViewController:svc];
[svc.navigationItem
setTitle:@"第一页"];
[svc.tabBarItem
setTitle:@"Setting"];
[svc.tabBarItem
setImage:[UIImage
imageNamed:@"setting.png"]];
[svc.tabBarItem
setBadgeValue:@"999+"];
[svc.view
setBackgroundColor:[UIColor
yellowColor]];
UITabBarController *tb = [[UITabBarController
alloc]init];
tb.viewControllers =
@[nvc,snvc];
[tb.tabBar
setTintColor:[UIColor
redColor]];
[tb.tabBar
setBarTintColor:[UIColor
orangeColor]];
[self.window
setRootViewController:tb];
[self.window
makeKeyAndVisible];
相关文章推荐
- build.gradle配置versionCode、versionName、apk的名字
- UIImage图片模式
- Vue 单引号问题
- kuangbin——线段树专题 G - Can you answer these queries?
- NGUI中Input制作方式
- RequireJS 主要函数
- HDU 5793 A Boring Question(多校6)
- 225.leetcode Implement Stack using Queues(easy)[两个队列模拟栈]
- Android学习之Bluetooth开发总结
- UITableViewCell中获取对应位置的输入框内容
- iOS中的UIWindow
- iOS UIAccelerometer
- poj 3061 Subsequence尺取法
- Camstar Portal modeling user guid --WorkCenter workCell workStation的关系
- Cannot read property 'value' of null
- 组TableView实现QQ好友列表效果
- 小米(MIUI)系统组招聘职位
- VR模式下的UI系统实践概述
- hdu 5793 A Boring Question(2016 Multi-University Training Contest 6——快速幂取模)
- (转载)Java自带的GUI性能监控工具Jconsole以及JisualVM简介