1.在项目的info.plist中添加key:
View controller-based status bar appearance Boolean:NO
2.添加代码
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
判断当前statusBar状态:
[UIApplication sharedApplication].statusBarHidden