I am working on an app with a navigation controller. I know how to set the title when the view loads initially. I push a new view controller and set it's title. Now the problem is when I press the back button, the title for the original view controller is not there anymore. I tried to do...
- (void)viewWillAppear:(BOOL)animated {
self.navigationController.title = @"Some Title";
}
This did not set the title though. Does anyone know what I can do?
A container view controller that defines a stack-based scheme for navigating hierarchical content.
The navigation item used to represent the view controller in a parent's navigation bar.
The gesture recognizer responsible for popping the top view controller off the navigation stack.
The UINavigationController gets the value for the title from the current UIViewController.
To set a the title for a view Controller, simply do the following:
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"Some Title";
}
For each of your View Controllers, including the root one.
Try changing the navigation item's title.
[self.navigationItem setTitle:@"Some Title"];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With