导航控制器内的标签栏控制器,如何将新的viewcontrollers推送到tabcontroller? [英] Tab bar controller inside a navigation controller, how to push new viewcontrollers to the tabcontroller?
问题描述
设计要求:
- 显示用户可以选择的项目列表
- 之后选择了一个项目后,用一个后退按钮将用户带到一个新视图。新视图应包含底部不显示在第一个屏幕中的选项卡列表
- 单击选项卡中的项目时,应显示带有后退按钮的新屏幕标签应该仍然可以在底部看到。
- 单击选项卡应该让用户将层次结构备份到#2。不到第一个屏幕。
- Show a list of items the user can pick from
- After having picked an item, bring the user to a new view with a back button. The new view should contain a list of tabs at the bottom that are not present in the first screen
- When clicking an item in the tabs, a new screen should appear with a back button and the tabs should still be visible at the bottom.
- Clicking a tab should take the user back up the hierarchy to #2. Not to the first screen.
我试过以下结构:
-
UINavigationController
-
UIViewController
带有UITableView
-
UIViewController
带有UITabBar
(像这里一样) http://www.wiredbob.com/2009/04/ iphone-tweetie-style-navigation.html )
UINavigationController
UIViewController
with aUITableView
UIViewController
with aUITabBar
(like here http://www.wiredbob.com/2009/04/iphone-tweetie-style-navigation.html)
以及
-
UINavigationController
-
UIViewController
使用UITableView
-
UITabbarController
UINavigationController
UIViewController
with aUITableView
UITabbarController
这两种情况都可以正常显示 UITabBar
,但是当我点击其中一个标签中的某个项目并推送一个新的 UIViewController
,然后底部的标签消失。我希望选项卡保留在 UITabBarController
的选项卡内的所有推送 UIViewControllers
。
Both cases work fine with displaying the UITabBar
, but when I click an item in one of the tabs and push a new UIViewController
, then the tabs at the bottom disappears. I want the tabs to remain in place for all pushed UIViewControllers
that occurs inside a tab of the UITabBarController
.
一个相关的问题就是这个问题,但它没有处理选项卡中推送的viewcontrollers问题:
导航控制器内的导杆控制器,或共享导航根查看
A related question is this one but it doesn't deal with the problem of pushed viewcontrollers inside a tab: Tab bar controller inside a navigation controller, or sharing a navigation root view
我是否需要将root控制器更改为 UITabController
?有人实际实现了吗?
Do I need to change the rootcontroller to the UITabController
? Anyone actually implemented this?
推荐答案
这是正确的结构:
UITabBarcontroller (UIWindow's rootViewController)
->UINavigationController (first tab)
-->UIViewController
->UINavigationController (second tab)
-->UIViewController
这篇关于导航控制器内的标签栏控制器,如何将新的viewcontrollers推送到tabcontroller?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!