UIStatusBarStyleDefault:字体为黑色(时间、运营商、WiFi等标志的显示颜色)
UIStatusBarStyleLightContent:字体为白色
1.plist中设置View controller-based status bar appearance为NO
2.- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions中设置
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];//当前黑色,如果要白色可以改成UIStatusBarStyleLightContent
3.如果有单独一个ViewController为白色,可以这样设置
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];//白色
}
-(void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;//退出当前ViewController后变回黑色
}
UIStatusBarStyleLightContent:字体为白色
1.plist中设置View controller-based status bar appearance为NO
2.- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions中设置
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];//当前黑色,如果要白色可以改成UIStatusBarStyleLightContent
![](http://cdn.cocimg.com/bbs/attachment/Fid_21/21_2069_71251fa2c453037.png)
3.如果有单独一个ViewController为白色,可以这样设置
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];//白色
}
-(void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;//退出当前ViewController后变回黑色
}
![](http://cdn.cocimg.com/bbs/attachment/Fid_21/21_2069_33162ae6c60f981.png)