iOS 13 Setting status bar text color from within UINavigationController

前端 未结 3 2041
轮回少年
轮回少年 2021-01-21 17:34

So before iOS 13, I was setting the NavigationController.NavigationBar.BarStyle to control the colour of the text int he status bar. But now witht he new UINavigationBarAppearan

3条回答
  •  一整个雨季
    2021-01-21 17:52

    In Info.plist, if added the Boolean Property UIViewControllerBasedStatusBarAppearance and set its value to False

    UIViewControllerBasedStatusBarAppearance
    
    

    And you can change StatusBar TextColor by follow way :

    UIApplication.SharedApplication.SetStatusBarStyle(UIStatusBarStyle.LightContent, true);
    

    In addition , this method should be invoked after View loaded totally . From IOS 13 ,Apple separates the UI from the Controller, which may affect the appearance of the PreferredStatusBarStyle in the Controller. Before this problem is handled, you can use UIApplication.SharedApplication.StatusBarStyle to set it.

提交回复
热议问题