nilkash nilkash - 25 days ago 10
Objective-C Question

Navigation bar Hidden not working IOS

Hi I'm new in iOS development. I've one main screen with navigation bar hidden true. From there I am navigating to another view using back segue. but when I click back it showing navigation bar on main screen. Here is my problem description.

In main screen onviewload I am doing :

self.navigationController.navigationBarHidden = YES;


once user go to another view using back segue in new controller, I'm doing

self.navigationController.navigationBarHidden = NO;


And now, if I click back it will show navigation bar on main window also which I don't want. Basically I want main screen without navigation bar and next window with navigation bar.

How to do this. Need Help. Thank you.

Answer

Put that code in viewWillAppear instead of viewDidLoad, and it should work properly.