The correct way to set a light status bar text color in iOS 7 based on different ViewControllers

后端 未结 8 1250
死守一世寂寞
死守一世寂寞 2020-12-25 14:52

I need to let a specific ViewController embedded in an UINavigationController to have light status bar text color (but other ViewControllers to beh

8条回答
  •  梦谈多话
    2020-12-25 15:20

    Currently you can only do light and dark. To change to light do.

    1. Set the UIViewControllerBasedStatusBarAppearance to YES in the .plist file.

    2. In the viewDidLoad method do [self setNeedsStatusBarAppearanceUpdate];

    3. Add the this method:

    -(UIStatusBarStyle)preferredStatusBarStyle{ return UIStatusBarStyleLightContent; }

    To change it back to dark change the UIStatusBarStyleLightContent to UIStatusBarStyleDefault

提交回复
热议问题