Question

I want to hide the top bar of the first view controller.

I know that I cannot just edit the file for that view controller since it's copyrighted by Apple. So I need to build a new controller file custom class, and attach that to the view controller that i want the top bar hidden for.

Then, how do I edit this newly-created .m file so that it hides the top bar for the view controller I want hidden?

Thank you! :)

Was it helpful?

Solution

One option is to do the following:

In View Controller 1:

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];

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

In View Controller 2:

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];

    [self.navigationController setNavigationBarHidden:NO animated:animated];
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top