NavigationController 内的 TabBarController
想象一下,我们有由导航控制器控制的多视图应用程序。我们使用pushViewController方法从第一个视图转到第二个视图,这不是问题,但我们需要移动到第三个视图。第三个是一个看起来像 TabBar 的视图。我们该怎么做呢?第三个视图应该由 TabBarController 控制,不是吗? 那么如何传递控制呢?我声明了一个插座 UITabBarController * tbc 并将其连接到 xib 文件中的 TabBarController ,然后我在 viewDidLoad 中尝试了此操作: tbc = [[UITabBarController 分配]init];
它什么也没显示。 非常感谢您的帮助
Imagine that we have multiview apllication which is controlled by Navigation Controller. We go from the first view to second by using pushViewController method and that's not a problem but then we need to move to the third view. And the third one is a view which looks like a TabBar. How do we do that? The third view is supposed to be controlled by TabBarController, isn't it?
So how to pass the control? I declared an outlet UITabBarController * tbc and connected it to TabBarController in xib file and then i tried this in viewDidLoad:
tbc = [[UITabBarController alloc]init];
and it shows nothing.
Your help is highly appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这有点奇怪。更标准的是有一个 tabBarController 来切换视图,其中一些视图可能是导航控制器。但是...
创建 UITabBarController 并推送它。
然后,从 tabBarContoller 视图中,基于某些操作,您可以选择弹出它:
It's a bit wierd. Its more standard to have a tabBarController that switches views and some of those views may be navigation controllers. But ...
Create the UITabBarController and push it.
Then, from the tabBarContoller view, based on some action, you can choose to pop it:
您可以在最新版本的 Xcode 的故事板编辑器中将其连接起来。
然而,由于这在很大程度上是非标准的控件使用,因此您需要一个非常充分的理由来解释为什么需要这样的 UI。
即便如此,如果界面笨拙,苹果的审核流程也可能会拒绝你的应用程序。
You can wire it up in the storyboard editor in the latest version of Xcode.
However, since this is very much non-standard use of the controls, you would need a very good reason as to why you would want a UI like this.
And even then, Apple's review process might turn your app down if the interface is clunky.