5

In some UIViewController, UINavigationBar hides under status bar. Here is the screenshot:

<code>UINavigationBar</code> under StatusBar

But when I change View controller-based status bar appearance to YES then UINavigationBar looks perfect. Here is the screenshot:

black text in <code>UIStatusBar</code>

But in this case, textColor of status bar goes change from white to black. I want white text color of status bar and also unhide UINavigationBar from status bar. Is there any way to solve out it (White color of status bar and unhide UINavigationBar).

Thanks in advance!

Sudha Tiwari
  • 2,499
  • 26
  • 50

3 Answers3

2

You can always manually set the origin of the navigation bar in viewWillAppear(animated: Bool)

self.navigationController?.navigationBar.frame.origin = CGPoint(0, 20)
Zach P
  • 51
  • 6
1

Add these keys to your project Info.plist and you should be ok.

<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleLightContent</string>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
AlBlue
  • 23,254
  • 14
  • 71
  • 91
吴山山
  • 11
  • 1
0

Add this code in your Appdelegate and info.plist

in info.Plist

View controller-based status bar appearance to NO

In Appdelegate

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
Jugal K Balara
  • 917
  • 5
  • 15