Change back Button Title after Push Segue

887 Views Asked by At

I Have a DetailViewController that is pushed from MasterViewController as in figure below:

enter image description here

When the detail view shows up it has a "back" button title is equal to the file name of the MasterViewController: "Master" (because I have a custom title with two labels in MasterViewController).

Is there a way to modify it?

enter image description here

MasterViewController compound title:

UIView *titleView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 150, sum + 20)];

[titleView addSubview:first];
[titleView addSubview:second];

self.navigationController.navigationBar.topItem.titleView = titleView;

I have tried with no luck:

self.navigationController.navigationBar.backItem.title = @"AAA";
self.navigationController.navigationItem.backBarButtonItem.title = @"AAA";
self.navigationItem.backBarButtonItem.title = @"AAA";

I have noticed that in the view hierarchy there is no NavigationItem or NavigationBar in DetailViewController, and thus adding it there is no possibility to add the left arrow to the BarButtonItem

enter image description here

There is also another question similar to this but with no clear answers.

1

There are 1 best solutions below

2
On BEST ANSWER

What is showing is the title property of the view controller so in MasterViewController set

self.title = @"AAA"