状态栏实时显示,隐藏及改变样式

#1、隐藏状态栏方式:
->1.

-(BOOL)prefersStatusBarHidden{
    return YES;
}

->2.

[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];   

#2、状态栏setStatusBarHidden 设置无效解决办法:
在plist添加字段 View controller-based status bar appearance 为NO

如图:
图

#3、设置状态栏StatusBar颜色样式: ->1.

- (UIStatusBarStyle)preferredStatusBarStyle
{
    return UIStatusBarStyleLightContent;
}

->2.

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];

#4、设置闪屏时状态栏StatusBar颜色样式:

如图:
图