Reputation: 614
I'm trying to change Back Button tittle in a NavigationController in the following way:
In the parent controller I put this in vieDidLoad
:
self.title = @"Calendars";
self.navigationItem.backBarButtonItem.title = @"Previous";
But this controller is in the stack since I initialized the app:
-(void)applicationDidFinishLaunching:(UIApplication *)application{
navController.viewControllers= [NSArray arrayWithObjects:aController,aBcontroller,nil];
[window addSubview:navController.view];
}
So, the viewDidLoad in aController is not called until I select the back buttom the first time in the bController...
Does anyone knows how to call viewDidLoad just when I push it into the stack? Or do you know another way to change the BackButtom title?
Upvotes: 1
Views: 5645
Reputation: 21
Upvotes: 0
Reputation: 6458
You can set the title of the back button for any ViewController you're in with the following line of code:
self.navigationController.navigationBar.backItem.title = @"Previous";
Upvotes: 3
Reputation: 15706
You should put your code to set up the title and navigationItem in init
, you don't need to wait until the view is loaded.
Upvotes: 1