1.全局隱藏statusBar 在APPDelegate中,設(shè)置application.statusBarHidden為YES.
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];
2, 在info.plist中,設(shè)置UIViewControllerBasedStatusBarAppearance為false。
要單獨隱藏某個ViewController的statusBar呢,需要重寫prefersStatusBarHidden方法
- (BOOL)prefersStatusBarHidden {
return YES;
}