默认状态下
状态栏的内容为黑色,背景色为白色
想要改变状态栏的字体,电源,运营商等内容的颜色需要
下面代码是将状态栏内容改为白色
在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];
网友评论