如果要設(shè)置全局
View controller-based status bar appearance : NO
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO];//此句代碼才有效果
如果要設(shè)置針對某個界面
View controller-based status bar appearance : YES
if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {
//調(diào)用隱藏方法
[self prefersStatusBarHidden];
[self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];
}
- (BOOL)prefersStatusBarHidden {
return YES;
}