1、整个APP的状态栏都是白色
在App delegate.m 文件中的didFinishLaunchingWithOptions:方法中,加入以下内容:
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:NO];
2、指定页面状态栏为白色,在指定的viewcontroller中加入以下内容:
- (void)viewWillAppear:(BOOL)animated {
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:NO];
[super viewWillAppear:YES];
}
- (void) viewDidDisappear:(BOOL)animated {
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault animated:NO];
[super viewDidDisappear:YES];
}
两种情况都要在info.plist 文件中加入View controller-based status bar appearance, Boolean 类型值 设为NO,才可生效。