如何消除导航栏?

Posted

技术标签:

【中文标题】如何消除导航栏?【英文标题】:How to eliminate NavigationBar? 【发布时间】:2017-05-05 04:06:23 【问题描述】:

我是 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;
    

我想消除红色虚框所示的空间。

【问题讨论】:

【参考方案1】:

NavigationBarHidden属性设置为false:

NavigationController.NavigationBarHidden = true;

或者,如果您要为其设置动画,请使用 SetNavigationBarHidden 方法:

动画隐藏:

NavigationController.SetNavigationBarHidden(true, true);

动画表演:

NavigationController.SetNavigationBarHidden(false, true);

回复:iOS NavigationControllers

【讨论】:

以上是关于如何消除导航栏?的主要内容,如果未能解决你的问题,请参考以下文章