Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide navigation bar in UINavigationViewController's root view, but show it in others

I am a beginner in iOS development, and the title pretty much says it.

I have a UINavigationController; I'd like it not to show the navigation bar if the user is looking at the root view, but show the navigation bar in other views.

Is there an elegant way to do this?

like image 247
houbysoft Avatar asked Dec 21 '22 04:12

houbysoft


1 Answers

Use this line of code on all your view controllers [navigationController setNavigationBarHidden: YES animated:YES]; If no animation is needed you can do animated:NO and add this code in viewDidLoad otherwise put it viewWillAppear or viewDidAppear

like image 86
thvanarkel Avatar answered Mar 08 '23 22:03

thvanarkel