我可以拥有多个UITabBarController吗? [英] Can I have more than 1 UITabBarController?
问题描述
让我们想象一下这种情况:
Lets imagine the scenario:
UITabBarController
-UITabBar
-选项卡1:查看控制器A
-选项卡2:查看控制器B
UITabBarController - UITabBar - Tab 1: View Controller A - Tab 2: View Controller B
当我单击View Controller AI时,我想推另一个UITabBarController:
When I click on View Controller A I want to push another UITabBarController:
UITabBarController
-UITabBar
-选项卡1:视图控制器1
-选项卡2:视图控制器2
-选项卡3:视图控制器3
UITabBarController -UITabBar - Tab 1: View Controller 1 - Tab 2: View Controller 2 - Tab 3: View Controller 3
这可能吗?要拥有一个UITabBarController将另一个UITabBarController推入视图堆栈?
Is this possible? To have a UITabBarController push another UITabBarController onto the view stack?
推荐答案
您当然可以这样做,但是我会重新考虑您的设计。选择UITabBar项并更改选项卡栏本身与人机界面指南。此外,在您的示例中,如何返回到根视图控制器?
You can certainly do this but I would rethink your design. Selecting a UITabBar item and changing the Tab Bar itself goes against Human Interface Guidelines. Besides, in your example, how do you get back to the root view controller?
也许您应该使用UITableView,当您点击一个单元格时,它会推入一个包含以下内容的视图控制器一个UITabBarController(从技术上讲,这也可能与HIG背道而驰,因为选项卡栏在整个应用程序中应该是相同的,但是我有很多应用程序都采用了它,而且看起来很优雅)。因此,以您的示例为例:
Perhaps you should use a UITableView that when you tap a cell it pushes a view controller containing a UITabBarController (technically this might go against HIG too since a tab bar should be the same throughout an entire app but I've had plenty of apps adopt this and it seems elegant). So using your example:
RootViewController:
作为UINavigationController推送,其中UITableView包含两个单元格:
cell1& cell2
RootViewController: pushed as UINavigationController with a UITableView containing two cells: "cell1" & "cell2"
-在 cell1上轻按可推动包含UITabBar(I)的视图控制器,该视图控制器包含 View Controller A和 View Controller B。
-Tapping on "cell1" pushes a view controller containing UITabBar(I) which contains "View Controller A" and "View Controller B."
-轻按 cell2将推入包含UITabBar(II)的视图控制器,其中包含 View Controller 1, View Controller 2和 View Controller 3。
-Tapping on "cell2" pushes a view controller containing UITabBar(II) which contains "View Controller 1," "View Controller 2," and "View Controller 3."
在每种情况下,您都将获得一个后退按钮,而UITabBar本身不必更改。
In each case, you get a "back" button and the UITabBar itself doesn't have to change.
这篇关于我可以拥有多个UITabBarController吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!