ios- each show different colors of the status bar

Project requirements, different pages UI design in the top of each page of the status bar font color, need to dynamically switch.

The first step, info.plist set

添加View controller-based status bar appearance

The corresponding value of type bool NO

The second step, you need to Page Setup

- (void) viewWillAppear: (BOOL) animated call

-(void)viewWillAppear:(BOOL)animated{

    [superviewWillAppear:animated];

    [UIApplication sharedApplication].statusBarStyle =UIStatusBarStyleLightContent;

}

Note that this only black and white colors of the switching function and do not need to call preferredStatusBarStyle

Reproduced in: https: //www.jianshu.com/p/d90aa8f6a6f8

Guess you like

Origin blog.csdn.net/weixin_33694172/article/details/91236193