Annu
Annu

Reputation: 479

Hide UINavigationbar and yet show Status bar on Xamarin.iOS

I want to hide UINavigation Bar and only show Status bar for the Rootview controller. this.NavigationController.SetNavigationBarHidden(true, true);

hides both. now it look like this .

Upvotes: 1

Views: 2145

Answers (3)

Kevin Li
Kevin Li

Reputation: 2258

Status Bar:

enter image description here

Navigation Bar:

enter image description here

So, your screenshot shows the Status Bar and didn't show the Navigation Bar. The code works fine as you expected.

For more details on how to hide/show Status Bar and Navigation Bar, please see the below section:

  1. To hide/show Status Bar you need to add this setting in your info.plist file:

    <key>UIViewControllerBasedStatusBarAppearance</key>
    <false />
    

    Then add the code in your ViewController:

    UIApplication.SharedApplication.SetStatusBarHidden(true/false,true);
    
  2. To hide/show the Navigation Bar, you just need to add the codes in ViewWillAppear:

    this.NavigationController.SetNavigationBarHidden(true/false, true);
    

Upvotes: 2

First check that in the file info.plist

enter image description here

Verify that Hide status bar is not checked. If you want to show the status bar.

enter image description here

and let me know if solve your problem.

Upvotes: 0

Siti
Siti

Reputation: 130

Sorry, I can't comment because I don't have enough reputation.

From your attached picture & question to hide UINavigationBar & only show Status Bar, it looks like it is correct & your code is correct too.

Attached is answer maybe you looking for: How to hide Navigation Controller in Root View?

Upvotes: 0

Related Questions