Navigation Back Button in iPhone 6

Hi,

I am trying to set/remove the text of the navigation button in a Xamarin Forms app. It seems to work fine in Android, and it appears as "Back" on the iPhone 5S simulator. However, on the iPhone 6 (both physical device and simulator), the back button is taking the title of previous page ("Current Performace").

The setup is a Master/Detail page, with the detail page ("Current Performace") being a navigation page with a listview, and when the user clicks on an item in the listview, it navigates to another page (with a title of the Team Name). On the Team Performace page, I set the Back Button title using the following code:

public partial class SingleTeamDashboardView : ContentPage { public SingleTeamDashboardView() { InitializeComponent(); NavigationPage.SetBackButtonTitle(this, String.Empty); } }

Is there something that I am doing wrong? Ideally I want the back button to just be the < arrow. I have also noticed that when I go to a team with a long name, which causes the title to be long, then it does display the word "Back", but it still says "Back" when I am in French.

I have attached screenshots to show the main issue.

Any help would be appreciated

Sam

Posts

  • JSpringJSpring GBUniversity ✭✭

    Have you tried overriding the title to ""? Im not sure if Xamarin.Forms handles this differently but UINavigationController will always place the previous View's title as the title of the back button.

    If you want a plain < then it would be better to place your own button there that will pop that view of the nav stack when clicked.

  • rschmidtrschmidt USMember ✭✭

    Try setting the back button on the "Current Performance" controller instead of the "Team Performance" controller.

    I'm not sure if this is different when you're using Forms (and I'm also not sure what these things are called on Forms), but on iOS there is a common misconception about the back button. Setting the BackBarButton property on a controller like you're doing does NOT change the back button title when that controller is presented. Instead, it changes the back button title when another controller is presented on top of that controller. The controller that the back button sends you to is the one that decides what the back button says, not the controller that is visible.

    For example if you have controller A and controller B, and you want the back button to be empty when B is on top of A, then you set the BackBarButton property to empty on A, not on B.

    As for the button being in English when the operating system is in French, see this thread:

    http://forums.xamarin.com/discussion/26691/info-how-to-change-language-e-g-back-cancel-in-standard-controls-in-ios

Sign In or Register to comment.