我是 Xamarin iOS 开发新手。 我在我的项目中使用 NavigationController。 我想在特定的 ViewController 中隐藏 NavigationBar。 以下代码隐藏了栏,但没有消除空格。
public override void ViewWillAppear(bool animated)
{
base.ViewWillAppear(animated);
this.NavigationItem.LeftBarButtonItem = null;
this.NavigationItem.HidesBackButton = true;
this.NavigationController.ToolbarHidden = true;
}
最佳答案
将 NavigationBarHidden
属性设置为 false:
NavigationController.NavigationBarHidden = true;
或者,如果您要为其设置动画,请使用 SetNavigationBarHidden
方法:
动画隐藏:
NavigationController.SetNavigationBarHidden(true, true);
动画展示:
NavigationController.SetNavigationBarHidden(false, true);
关于ios - 如何消除NavigationBar?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43796327/