Bulla Bulla - 4 months ago 10
iOS Question

How to change the UINavigationController back button name?

I have a

UIViewController
and I'm navigating from my first view controller to second view controller and I want to change the name of the button shown on the
navigationcontroller
for going back ....

SecondViewController *secondController = [[SecondViewController alloc]
initWithNibName:nil
bundle:NULL];
[self.navigationController pushViewController:secondController animated:YES];


now in the second
viewcontroller
I want change the name of the button in the
navigationController
.

Answer

In viewWillAppear write this

self.navigationItem.title = @"List View";

And in ViewWilldisapper write this

self.navigationItem.title = @"Back";

It works without story boards.

Comments