Reputation: 1089
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
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
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
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