iOS7默认状态栏文字颜色为黑色
修改为白色的方法:(chenyong注意 我的Status bar style 使用的仍是默认值Gray style(default))
1在Info.plist中设置View controller-based status bar appearance 为NO
2 在需要改变状态栏颜色的ViewController中在ViewDidLoad方法中增加:
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
如下:
- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view from its nib. [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent]; }
如果需要在全部View中都变色,可以写在父类的相关方法中。
在使用Cordova的时候遇到的状态栏合并问题
- (void)viewWillAppear:(BOOL)animated { // View defaults to full size. If you want to customize the view's size, or its subviews (e.g. webView), // you can do so here. // 导航与状态栏合并的问题 float currentVersion = [[[UIDevice currentDevice] systemVersion] floatValue]; if (currentVersion >= 7) { // bounds 是以自身的左上角为坐标原点 CGRect viewBounds = [self.webView bounds]; viewBounds.origin.y = 20; viewBounds.size.height = viewBounds.size.height - 20; self.webView.frame = viewBounds; self.view.backgroundColor = [UIColor blackColor]; } [super viewWillAppear:animated]; }
本文详细介绍了在iOS7中如何将默认的黑色状态栏文字颜色修改为白色的方法。通过在Info.plist中设置并调整ViewController中的代码实现状态栏颜色变化。同时,解决了使用Cordova时遇到的状态栏合并问题。
1772

被折叠的 条评论
为什么被折叠?



