- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:YES animated:NO];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
}
- (void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
[self.navigationController setNavigationBarHidden:NO animated:NO];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
}
第一步:在Info.plist中设置UIViewControllerBasedStatusBarAppearance 为NO
第二步:在appdelegate中加下一句
UIApplication.sharedApplication().statusBarStyle = UIStatusBarStyle.LightContent;
这样就可以把默认的黑色改为白色。
UIApplication.shared.isStatusBarHidden = true
可进行状态栏的隐藏