How to change the text of the BACK button in Xamarin.Ios

Asked

Viewed 56 times

0

I wanted to change the Text that is on the BACK button on IOS

inserir a descrição da imagem aqui

What I tried to:

     public override void ViewDidLoad()
            {
                NavigationItem.BackBarButtonItem = new UIBarButtonItem { Title = "Teste" };

                base.ViewDidLoad();

                 //nao funciona NavigationItem.BackBarButtonItem = new UIBarButtonItem { Title = "Teste" };

                    //nao funciona NavigationController.NavigationBar.BackItem.BackBarButtonItem.Title = "teste";
    }

public override void ViewDidAppear(bool animated)
        {
             NavigationItem.BackBarButtonItem = new UIBarButtonItem { Title = "Teste" };

                base.ViewDidLoad();

                 //nao funciona NavigationItem.BackBarButtonItem = new UIBarButtonItem { Title = "Teste" };

                    //nao funciona NavigationController.NavigationBar.BackItem.BackBarButtonItem.Title = "teste";
        }

None of these ways worked.

  • instantiate the button as NavigationPage instead of NavigationItem doesn’t work?

1 answer

0


The solution I found was the following:

        this.NavigationItem.SetLeftBarButtonItem(new UIBarButtonItem("Novo Texto", UIBarButtonItemStyle.Plain, (sender, args) => 
        {
            this.NavigationController.PopViewController(true);

        }), true);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.