iOS 状态栏黑色背景白色字体

一、 状态栏背景(黑色)的设置

1.在有导航栏的情况下,给导航栏设置一个像素为44的背景图片即可

[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"导航栏背景图片名"] forBarMetrics:UIBarMetricsDefault];

2.在没有导航栏的情况下,改变window的frame   

self.window.frame = CGRectMake(0, 20, self.window.frame.size.width, self.window.frame.size.height - 20);

二、状态栏前景的设置

1.在Info.plist中增加Key:View controller-based status bar appearance  布尔值Value:NO

2.设置前景颜为白色

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
此文章为个人笔记,方便自己以及有需要的朋友查看,转载请注明出处!
原文地址:https://www.cnblogs.com/shpyoucan/p/5407311.html