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 >= ) {
// bounds 是以自身的左上角为坐标原点
CGRect viewBounds = [self.webView bounds];
viewBounds.origin.y = ;
viewBounds.size.height = viewBounds.size.height - ;
self.webView.frame = viewBounds;
self.view.backgroundColor = [UIColor blackColor];
} [super viewWillAppear:animated];
}
05-13 22:26