0
votes

I have a Xamarin Forms project, where the Android part is working fine. But in the navigation bar of my iOS App I have the problem that the title of some pages are too long.

So what I want to do is just replacing the title of the back button with the title of the page. I already have a custom NavigationRenderer for some other adjustments in iOS. In the ViewDidAppear Method of the NavigationRenderer I have tried:

NavigationItem.BackBarButton.Title = NavigationItem.Title;
NavigationItem.Title = "";

But it didn't changed anything. I also tried this with the RootController and even tried this with overriding in a custom ViewController. Nothing worked so far.

So my question is how can I accomplish this? Is the NavigationRenderer the wrong place to do it?

1

1 Answers

2
votes

You generally set the back button title in the page the back button refers to i.e. the one before the page that is now showing.

NavigationPage.SetBackButtonTitle(this, "My Short Title");

So you would have to set it before you navigate to the new page if you want the new page title as the back button title.