How to change Navigationbar title irrespective of Tab title
I guess your project's hierarchy may be like this:
NavigationPage => TabbedPage => children pages.
Then every time the child page's title changes, the TabbedPage
's title will change too. Even though we make a custom renderer for this child page, it's hard to change the page's navigationBar's title. Because the NavigationCtroller's root viewController is your tabbed page.
I recommend you to adjust your project's hierarchy, make each child page wrapped by a navigation page like:
In this way, you can set the navigation page's title to adjust the tab item's title and change the navigation bar's title through setting the Homework
's title.
You can refer to my code about constructing app()
:
// This is a TabbedPage
var tabbedPage = new MyTabbedPage();
var firstPage = new MainPage();
// The NavigationPage's Title will be shown on the tab, and firstPage's title can be shown on the navigation bar
tabbedPage.Children.Add(new NavigationPage(firstPage) { Title = "FirstPage" });
var homePage = new Homework();
tabbedPage.Children.Add(new NavigationPage(homePage) { Title = "SecondPage" });
MainPage = tabbedPage;