设置状态栏颜色
2015-04-21 09:41 可小猪 阅读(216) 评论(0) 编辑 收藏 举报//设置状态栏的颜色
[[UINavigationBar appearance] setBarTintColor:[UIColor blackColor]];
//// 默认带有一定透明效果,可以使用以下方法去除系统效果
// [self.navigationController.navigationBar setTranslucent:NO];
//
////// 公司项目需要将状态栏的文字颜色设置为白色,以下方法即可
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
//// 改变后需要及时刷新的调用
[self setNeedsStatusBarAppearanceUpdate];
}
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
//// 改变后需要及时刷新的调用
[self setNeedsStatusBarAppearanceUpdate];
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/