UIStatusBarStyle not working in Swift

前端 未结 11 597
轻奢々
轻奢々 2020-12-22 18:30

I\'m trying to change the Status Bar color in my Swift app to white, but am hitting a brick wall. I have 3 ViewControllers that are each embedded in a NavigationController (

11条回答
  •  不知归路
    2020-12-22 19:24

    On iOS 9 the following (setStatusBarStyle) is deprecated and you will get a warning if you go that way.

    UIApplication.sharedApplication().setStatusBarStyle(UIStatusBarStyle.LightContent, animated: true)
    

    If you want all statusBars changed in a single shot try adding the following to your Info.plist. This will also make your launch-screen status bar white. While the code above won't.

    UIStatusBarStyle
    UIStatusBarStyleLightContent
    UIViewControllerBasedStatusBarAppearance
    
    

提交回复
热议问题