Daisuke SHIBATO
Daisuke SHIBATO

Reputation: 1013

How to eliminate NavigationBar?

I'm new in Xamarin iOS development. I use NavigationController in my project. I want to hide a NavigationBar in a particular ViewController. Following code hides the bar, but doesn't eliminate the space.

    public override void ViewWillAppear(bool animated)
    {
        base.ViewWillAppear(animated);
        this.NavigationItem.LeftBarButtonItem = null;
        this.NavigationItem.HidesBackButton = true;
        this.NavigationController.ToolbarHidden = true;
    }

I want to eliminate the space as shown in the red broken frame. enter image description here

Upvotes: 1

Views: 65

Answers (1)

SushiHangover
SushiHangover

Reputation: 74209

Set the NavigationBarHidden property to false:

NavigationController.NavigationBarHidden = true;

Or if you what to animate that, use the SetNavigationBarHidden method:

Animate hide:

NavigationController.SetNavigationBarHidden(true, true);

Animate show:

NavigationController.SetNavigationBarHidden(false, true);

Re: iOS NavigationControllers

Upvotes: 1

Related Questions