0

I am very new to iOS. Here is what I have implemented:

I am doing a app in iOS 4 (as it's required). I have used navigationController as root controller through app delegate.

Then from my first loaded view, I push to another viewcontroller which has implemented tabbar in it, say MyTabBarViewController.

MyTabBarViewController has say 3 viewControllers associated with it via:

MyTabBarController.viewControllers = [NSArray arrayWithObjects:yxzcontroller,abcController,nil];

Now I want to show the navigation bar for only the 2nd and 3rd viewcontroller and also want to customise it.

So how do I hide the navigationbar from first viewcontroller(yxzcontroller) of MyTabBarController and customise for others?

I tried:

[self.navigationController.navigationBar setHidden:YES];

I also tried:

[self.parentViewController.navigationController setNavigationBarHidden:YES animated:YES];

but these don't work from yxzcontroller.

To summarise:

I have NavController as root controller --> Normal ViewController -- > ViewController (with TabBarController)

TabBarController---> yxzcontroller,abcController

halfer
  • 19,824
  • 17
  • 99
  • 186
Nik
  • 2,913
  • 7
  • 40
  • 66

1 Answers1

1

I don't think you are supposed to have a tab bar controller in a nav controller. You can probably do it, it might get weird though.

You should be able to call

[self.navigationController setNavigationBarHidden:YES animated:NO];

in the ViewDidLoad of the views who's nav bar you want hidden.

Adam Shiemke
  • 3,734
  • 2
  • 22
  • 23
  • Thank you... as mentioned by you I have tried in ViewDidLoad, ViewDidAppear and also in ViewWillAppear... but non of these are working – Nik Mar 30 '12 at 09:28
  • And can I know why you said that we are not supposed to have a tabbar controller in a nav controller. Because I am doing this because I want to keep stack of flow between the tabs as well – Nik Mar 30 '12 at 09:29
  • That isn't the way apple wants you to do it. The tab bar controller paradigm is that a self-contained thing is present at each tab. If you don't want, that, you can fake it. See: http://stackoverflow.com/questions/576764/tab-bar-controller-inside-a-navigation-controller-or-sharing-a-navigation-root – Adam Shiemke Mar 30 '12 at 17:51