设置电池状态栏为白色

1、首先需要再info.plist中添加一项View controller-based status bar appearance为no

2、在需要的地方添加代码

  • (void)viewWillAppear:(BOOL)animated
    {
    [super viewWillAppear:animated];
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:NO];
    }
  • (void)viewWillDisappear:(BOOL)animated
    {
    [super viewWillDisappear:animated];
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault animated:NO];
    }

你可能感兴趣的:(设置电池状态栏为白色)