问题
I am trying to hide the back button from my navigationcontroller on a certain view(using storyboard)
I tried to hide the bar back button overriding the ViewWillAppear
, but it does not seem to happen.
Here is the code:
public override void ViewWillAppear (bool animated)
{
base.ViewWillAppear (animated);
this.NavigationController.NavigationItem.SetHidesBackButton (true, true);
}
回答1:
just change to :
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
this.NavigationItem.SetHidesBackButton (true, false);
}
回答2:
Below is the best answer which works well with xamarin forms too Add this code in App delegate.This solved my problem too
UIBarButtonItem.Appearance.SetBackButtonTitlePositionAdjustment (new UIOffset (-100, -60), UIBarMetrics.Default);
来源:https://stackoverflow.com/questions/21206744/xamarin-ios-hide-bar-back-button