1
votes

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?

3
Sounds like you should replace Hierarchical Navigation by Modal Pages.EvZ
@EvZ,I tried using Navigation.PushModalAsync instead of Navigation.PushAsync but no luck,Navigation.PushModalAsync using this removing entire navigation bar.sahithi
Thats expected outcome, you have to create a modal header view and place it on the top of the page.EvZ
Where did you put that piece of code?Daniel
@Daniel,I kept that at first view from xaml.cs constructor from here navigates to the other view,I wanted to remove/hide that back arrow in second view.sahithi

3 Answers

1
votes

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) => { });      
}
0
votes

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.

0
votes

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