我在许多应用程序中更改statusBar
颜色,但现在不知道发生了什么,但不会更改statusBar
颜色。StatusBar颜色不变
我的info.plist
基于控制器的视图状态栏外观 - > YES
我的ViewController ViewDidlLoad
// Set Status Bar
[self setNeedsStatusBarAppearanceUpdate];
- (UIStatusBarStyle)preferredStatusBarStyle
{
return UIStatusBarStyleLightContent;
}
,但它不会改变statusBar
颜色。
我把参考的形式此网址:https://teamtreehouse.com/community/ios-9-applicationsetstatusbarstyle-deprecated
它将使状态条的颜色为白色,但在所有ViewControllers。我想要statusBar
与1 ViewController中的黑色。
如何解决这个问题?
如何在特定的ViewController中将状态栏颜色更改为黑色? –
@Pankil UIApplication.shared.statusBarStyle =。lightContent在AppDelegate中添加此代码 –
@Pankil然后,您需要更改特定控制器中的statusBar(默认)样式,您需要将其设置为黑色并且在viewWillDisappear中再次需要将样式更改为lightContent –