开发者

NavigationController and TabBarController Together problem

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)
开发者_StackOverflow中文版----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.


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.


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.


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];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜