[iOS功能]- <=iOS 7 任意改变UIStatusBar颜色

1.plist中设置

View controller-based status bar appearance为NO
  UIViewControllerBasedStatusBarAppearance
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后变回黑色
}

你可能感兴趣的:([iOS功能]- <=iOS 7 任意改变UIStatusBar颜色)