iOS学习记录

[问]iOS开发--状态栏的内容颜色和背景色设置

2016-02-26  本文已影响1317人  BuzzLightYear23

默认状态下


状态栏的内容为黑色,背景色为白色


想要改变状态栏的字体,电源,运营商等内容的颜色需要


下面代码是将状态栏内容改为白色

在info.plist 文件中更改添加  View controller-based status bar appearance  == NO

然后添加代码,将[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;

想要改变状态栏背景颜色


下面代码是将背景色改为黑色

CGFloatstatwidth = [[UIApplicationsharedApplication]statusBarFrame].size.width;

CGFloatstatheight = [[UIApplicationsharedApplication]statusBarFrame].size.height;

UIView*statusBarView=[[UIViewalloc]initWithFrame:CGRectMake(0,0, statwidth, statheight)];

statusBarView.backgroundColor=[UIColorblackColor];

上一篇 下一篇

猜你喜欢

热点阅读