1、 info.plist文件中
View controller-based status bar appearance项设为YES,则View controller对status bar的设置优先级高于application的设置。
为NO则以application的设置为准,view controller的prefersStatusBarHidden方法无效,是根本不会被调用的。

2、
全局设置
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
局部设置
//是否隐藏状态栏
-(BOOL)prefersStatusBarHidden{
return YES;
}
//修改状态栏的样式
-(UIStatusBarStyle)preferredStatusBarStyle{
return UIStatusBarStyleLightContent;
}
3、效果图

4、是不是很心动,赶快试试吧❤️
网友评论