Xamarin IOS hide bar back button

只愿长相守 提交于 2019-12-23 16:14:05

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!