1
votes

In my iphone app, i have a navigation Controller and a tabBar Controller.

The TabBarController has three tabs. In the second and third Tab the NavigationController are added to the viewControllers.

Problem :

In third tab viewController shows the NavigationBar but the in second tab viewController doesnot display navigationBar.

Things I have tried and checked:

1) I checked that all the connections in IB are done properly

2) I checked the size of frame for the view. It doesnot overlap the navigationBar.

3) I also tried using self.navigationController.navigationBar.hidden = NO;

But still it does not show the navigationBar in the second tab.

What should I do?

Please Suggest

Please Help

Thanks!!

3

3 Answers

0
votes

We can't do much without looking at your code.

Assuming your TabBarController is properly connected in Interface Builder, you'll need something similar to this:

UIViewController *firstView = [[UIViewController alloc] init];
UIViewController *secondView = [[UIViewController alloc] init];
UIViewController *thirdView = [[UIViewController alloc] init];

UINavigationController *firstNav = [[UINavigationController alloc] initWithRootViewController:secondView];
UINavigationController *secondNav = [[UINavigationController alloc] initWithRootViewController:thirdView];

self.tabBarController.viewControllers = [NSArray arrayWithObjects:firstView, firstNav, secondNav, nil];

Of course, have every view released afterwards.

0
votes

Hmmm thats a problem i faced too.

If you look at your IB file ,you'll see that you can do a bit of tweaking and acheive it. i'll post details as soon as i get time.

0
votes

Oops!!! a big mistake on my part.I did not check the checkbox for "show navigation bar" in inspector for NavigationController. Hope this helps someone.