一、修改状态栏颜色
在info.plist中,添加View controller-based status bar appearance=NO
状态栏字体的颜色默认为白色
在appdelegate.m中添加代码
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
UIStatusBarStyleDefault:字体为黑色
UIStatusBarStyleLightContent:字体为白色
** 二、修改单个页面状态栏颜色**
1、在info.plist中,添加View controller-based status bar appearance=NO
2、在appdelegate.m中添加代码
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
3、在需要设置状态栏的vc中添加下方代码
-(void)viewWillAppear:(BOOL)animated{
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
}
-(void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
}
网友评论