在某些UIViewController中,UINavigationBar隐藏在状态栏下。截图如下:

但是,当我将View controller-based status bar appearance更改为YES时,UINavigationBar看起来很完美。截图如下:

但在这种情况下,status bar的textColor从白色变为黑色。我想要白色文本颜色的状态栏,也取消隐藏状态栏中的UINavigationBar。有没有办法解决这个问题(白色状态栏和取消隐藏UINavigationBar)。
提前感谢!
发布于 2016-06-21 16:49:29
您始终可以在动画中手动设置导航栏的原点(viewWillAppear: Bool)
self.navigationController?.navigationBar.frame.origin = CGPoint(0, 20)发布于 2016-06-21 17:24:20
将这些密钥添加到您的项目Info.plist中,就可以了。
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleLightContent</string>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>发布于 2016-06-21 16:11:09
将此代码添加到您的Appdelegate和info.plist中
在info.Plist中
View controller-based status bar appearance to NO在Appdelegate中
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];https://stackoverflow.com/questions/37938251
复制相似问题