首先看info.plist有一项叫View controller-based status bar appearance
1.不添加这一项的时候隐藏状态栏方法如下:
- (BOOL)prefersStatusBarHidden
{
return YES;
}
2.在info.plist添加View controller-based status bar appearance = NO的时候隐藏状态栏的方法如下:
[[UIApplication sharedApplication]setStatusBarHidden:YES];