سؤال

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);
}
هل كانت مفيدة؟

المحلول

just change to :

public override void ViewDidLoad ()
{
    base.ViewDidLoad ();

    this.NavigationItem.SetHidesBackButton (true, false);
}

نصائح أخرى

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);

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top