sahithi
sahithi

Reputation: 1089

Removing back arrow in navigation bar keeping back button title

I have xamarin forms ios application,where I need to remove the back arrow in the navigation bar but the title should be displayed and when user clicks on on that back button title it should navigate to previous view. I tried using `

NavigationPage.SetBackButtonTitle(this, "Cancel");

NavigationPage.SetHasBackButton(this, false);

But the back arrow is still displaying,is there any why to have only the text Cancel without <symbol?

Upvotes: 1

Views: 1115

Answers (3)

sahithi
sahithi

Reputation: 1089

I solved my issue by adding a custom renderer as follows

public override void ViewWillAppear(bool animated)
{      
    base.ViewWillAppear(animated);
    this.NavigationController.TopViewController.NavigationItem.LeftBarButtonItem =new UIBarButtonItem(“Cancel”, UIBarButtonItemStyle.Plain, (sender, args) => { });      
}

Upvotes: 1

jay_patel
jay_patel

Reputation: 31

Remove navigation-bar and use image/header on navigation place and write into image/Header into navigation title...

image onclick event into write back command

Upvotes: 0

Gerald Versluis
Gerald Versluis

Reputation: 34128

In your AppDelegate.cs file, in the FinishedLaunching method add these lines:

UINavigationBar.Appearance.BackIndicatorImage = new UIImage();
UINavigationBar.Appearance.BackIndicatorTransitionMaskImage = new UIImage();

This will however, remove it for every page. If you want it for just one page I would suggest like EvZ already mentioned: use a modal page or find another way.

Another way is to set the above lines to null which will restore the normal arrow. But this would mean implementing a custom renderer, dependency service or similar.

Upvotes: 0

Related Questions