设置状态栏的颜色

第一个方法:

//    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;

//    self.navigationController.navigationBar.tintColor = [UIColor blackColor];

//    self.view.window.frame = CGRectMake(0, 20, self.view.window.frame.size.width, self.view.window.frame.size.height - 20);

//    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:NO];

    

    第二个方法:

下面这个方法好像有个前提,默认的状态栏必须是隐藏的。

    UIView *statusBarView=[[UIViewalloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 20)];

    statusBarView.backgroundColor= LabelRedColor;

    [self.viewaddSubview:statusBarView];

 

    [[UIApplicationsharedApplication] setStatusBarStyle:UIStatusBarStyleLightContentanimated:NO];

你可能感兴趣的:(状态栏,颜色,StatusBar,状态栏颜色)