Having a UITabBar AND a UINavigationController in an app?(在应用程序中有一个 UITabBar 和一个 UINavigationController?)
问题描述
大家好,我是 iPhone 开发的新手,我不了解整个 UINavigationController 和 UITabBarController 的想法.一个可以替代另一个 - Tweetie 等应用如何将两者结合起来?
Hey everyone, I am new to iPhone development and I'm not understanding the whole UINavigationController and UITabBarController idea. Is one a substitute for the other - how do apps such as Tweetie combine both?
我想让我的应用程序在底部有一个持久的标签栏(这似乎正在工作),但在顶部还有一个导航栏,可以在不移除标签栏的情况下将视图推送/弹出到屏幕上.
I'd like to have my app have a persistent Tab Bar @ the bottom (which seems to be working), but also a Navigation bar at the top which can push/pop views onto the screen without removing the tab bar.
- 我怎样才能做到这一点?
- 就所有这些控制器而言,就我的 MainWindow.xib 而言,IB 中的层次结构应该是什么样的?
- 这里的最佳做法是什么?
非常感谢,
推荐答案
只需将视图控制器包装在 UINavigationController
中,并将 UINavigationController
放入 UITabBar代码>.这对你来说很好......
Just wrap the view controller inside the UINavigationController
and Place the UINavigationController
inside the UITabBar
.
This will work fine for you…
例子:
NSMutableArray *tabBarViewControllers = [[NSMutableArray alloc] initWithCapacity:2];
tabBarController = [[UITabBarController alloc] init];
[tabBarController setDelegate:self];
UINavigationController *navigationController = nil;
navigationController = [[UINavigationController alloc] initWithRootViewController:<Your View controller1>];
[tabBarViewControllers addObject:navigationController];
[navigationController release];
navigationController = nil;
navigationController = [[UINavigationController alloc] initWithRootViewController:<Your View controller2>];
[tabBarViewControllers addObject:navigationController];
[navigationController release];
navigationController = nil;
tabBarController = tabBarViewControllers;
[tabBarViewControllers release];
tabBarViewControllers = nil;
这篇关于在应用程序中有一个 UITabBar 和一个 UINavigationController?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在应用程序中有一个 UITabBar 和一个 UINavigationController?


- 如何在 iPhone 模拟器中重置 NSUserDefaults 数据? 2022-01-01
- 在 Iphone SDK 的导航栏上添加多个按钮 2022-01-01
- UITextView 内容插图 2022-01-01
- GPS状态的广播接收器? 2022-01-01
- Xcode 7.3 中带有 UILabel 的 UIStackView 2022-01-01
- URL编码Swift iOS 2022-01-01
- 类似于 Mail.app 的 iPad 模态视图控制器? 2022-01-01
- 网上有没有好的 UIScrollView 教程? 2022-01-01
- 使用自动布局向 UIScrollView 添加动态大小的视图 2022-01-01
- SetOnItemSelectedListener上的微调程序错误 2022-01-01