创建TabBarController中包含NavigationController
2016-03-10 10:37
288 查看
当用TabBarController作为app的根控制器时,还需要在里面的子viewController中加入NavigationController,这种情况在appDelegate可以这样写
如果有登录界面,进入后显示TabBarController,可以在登录界面写
跳转用present,不能用push
MainTabBarViewController *mainTabbar = [[MainTabBarViewController alloc] init]; MessagesViewController *messagesVC = [[MessagesViewController alloc] init]; UINavigationController *messagesNav = [[UINavigationController alloc] initWithRootViewController:messagesVC]; BookingsViewController *bookingsVC = [[BookingsViewController alloc] init]; UINavigationController *bookingsNav = [[UINavigationController alloc] initWithRootViewController:bookingsVC]; mainTabbar.viewControllers = @[messagesNav,bookingsNav]; self.window.rootViewController = mainTabbar;
如果有登录界面,进入后显示TabBarController,可以在登录界面写
MainTabBarViewController *mainTabbar = [[MainTabBarViewController alloc] init]; MessagesViewController *messagesVC = [[MessagesViewController alloc] init]; UINavigationController *messagesNav = [[UINavigationController alloc] initWithRootViewController:messagesVC]; BookingsViewController *bookingsVC = [[BookingsViewController alloc] init]; UINavigationController *bookingsNav = [[UINavigationController alloc] initWithRootViewController:bookingsVC]; mainTabbar.viewControllers = @[messagesNav,bookingsNav]; [self presentViewController:mainTabbar animated:YES completion:nil];
跳转用present,不能用push
相关文章推荐
- UIAlertController使用
- iOS通过dSYM文件分析crash
- ios9中的启动界面的设置
- powerdesigner 15以上 national 问题
- win10下genymotion启动不了,报错 unable to load virtualbox
- 57.深度优先搜索 广搜练习:迷宫(未结题)
- 进程、线程与处理器的调度(转)
- 版本控制之一:SVN服务器搭建与安装(转)
- 中缀转后缀并计算
- UITextField 对键盘一些常用属性 记录一下
- 57.深度优先搜索 广搜练习:迷宫(未结题)
- 57.深度优先搜索 广搜练习:迷宫(未结题)
- 57.深度优先搜索 广搜练习:迷宫(未结题)
- 1.C#中几个简单的内置Attribute
- caffe学习笔记1.1-- caffe的Makefile文件
- SQL SERVER字符串处理
- python进行Base64编码和解码
- Data Structures-1 bubble_sort中的change作用举例
- 2016年1月网络不良与垃圾信息:淫秽网站占比居首
- ios开发证书失效