默認狀態下
狀態欄的內容為黑色,背景色為白色
想要改變狀態欄的字體,電源,運營商等內容的顏色需要
下面代碼是將狀態欄內容改為白色
在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];