To add navigation bar in your app
Use following code in didFinishedLaunching:withOptions:
of AppDelegate
class:
ViewController *homeController = [[HomeController alloc] init];
self.controller = [[UINavigationController alloc] initWithRootViewController:viewController];
[self.window addSubview:self.controller.view];
[self.window makeKeyAndVisible];
In the ViewController
's viewWillAppear
method, Add the following line of code:
[[self navigationController] setNavigationBarHidden:YES animated:NO];
In the ViewController
's viewWillDisappear
method, Add the following line of code:
[[self navigationController] setNavigationBarHidden:NO animated:NO];