NavigationController 和 TabBarController 一起问题

发布于 2024-08-15 08:03:18 字数 519 浏览 4 评论 0原文

我有一个关于一起使用导航控制器和 tabBarController 的疑问。

我会详细解释。

我的应用程序流程如下,

Class A (Navigation starts from here)
--Class B (Pushed on navigation from A)
----Class C (Pushed on navigation from B)
------Tab P
------Tab Q
------Tab R (I want navigation here)
------Tab S (I want navigation here)

我的 C 类有一个带有四个选项卡的 TabBarController。 现在两个选项卡需要有导航。

我为两个选项卡(R 和 S)创建了两个单独的导航控制器 但是当我使用它时,屏幕上有两个导航栏。 其自身和其他根导航栏之一。

我需要隐藏根导航栏吗?怎么做呢? 还有其他办法吗?

请在这方面帮助我。

提前致谢。

I have a query regarding use of navigation Controller and tabBarController together.

I will explain in detail.

Flow of my application is as follows,

Class A (Navigation starts from here)
--Class B (Pushed on navigation from A)
----Class C (Pushed on navigation from B)
------Tab P
------Tab Q
------Tab R (I want navigation here)
------Tab S (I want navigation here)

My class C has a TabBarController with four Tabs.
Now two of the tabs need to have a navigation.

I have created two separate Navigation Controllers for two tabs (R and S)
But when I use it, there are two navigation bars on the screen.
One of itself and other Root Navigation Bar.

Do I need to hide root navigation bar? How to do it?
Is there any other way?

Please help me in this regard.

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

南…巷孤猫 2024-08-22 08:03:18

该流程听起来不太用户友好,在导航深入两层之后,用户期望一些详细的设置,而不是全新的 4 个选项卡屏幕。

建议,斯坦福大学在他们的 iTunesU 上免费提供完整的 iPhone 开发课程。它是由 Apple 员工提供的,在 NavigationController + TabBarController 类中,他们详细讨论了应该如何构建层次结构。

The flow doesn't sound that much user friendly, after going two levels deep in the navigation, the user expects some Detailed settings, not a whole new 4 Tabs screen.

Advice, Stanford University has a full iPhone Dev course available for free on their iTunesU. Its given by Apple employees, in the NavigationController + TabBarController classes they talk in details how you should build the hierarchy.

稚气少女 2024-08-22 08:03:18

根据 Apple 官方文档,您可以将 TabBarController 放入 NavBarController 中,但不应该以相反的方式放置。

也就是说,当您从 NavBarController 的屏幕中选择它时,您可以通过用 TabBarController 替换根视图控制器来破解它。这会隐藏导航栏。但是,当然,您不会拥有可以方便地弹出的导航控制器堆栈,并且顶部也没有带有返回按钮的导航栏。

如果您将选项卡栏放入 NavBarController 堆栈中,您可能需要重新考虑导航层次结构。

You can put a TabBarController inside a NavBarController, but you're not supposed to put it the other way around, according to the official Apple documentation.

That said, you can hack it by replacing the root view controller with the TabBarController when you select it from your NavBarController's screen. That would hide the navigation bar. But of course you won't have the stack of nav controllers that you can conveniently pop off, and you don't have the nav bar at the top with a button to go back.

You might need to rethink your navigation hierarchy if you're putting a Tab bar inside a NavBarController stack.

压抑⊿情绪 2024-08-22 08:03:18

还需要注意的一件事是,如果您隐藏应用程序的导航栏,那么在 C 类中您将无法以正常方式转到前面的类,当然不会那么用户友好。

顺便说一句,您可以将导航栏隐藏为..

[self.navigationController setNavigationBarHidden:Yes];

one thing to notice also If you hide the application's navigation bar, at the class C you will not be able to go to the previous classes in a normal way, certainly it will not be that much user friendly.

By the way you can hide the navigation bar as..

[self.navigationController setNavigationBarHidden:Yes];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文