解決方法如下:
一:在MainViewController.m中添加如下代碼:
-(void)viewWillDisappear:(BOOL)animated
{
if([[[UIDevice currentDevice]systemVersion ] floatValue]>=7)
{
CGRect viewBounds=[self.webView bounds];
viewBounds.origin.y=20;
viewBounds.size.height=viewBounds.size.height+20;
self.webView.frame=viewBounds;
}
[super viewWillDisappear:animated];
}
二:
- 打開http://cordova.apache.org/plugins,
- 搜索statusbar
- cmd進入cordova目錄使用cordova plugin add cordova-plugin-statusbar
- 添加成功后然后,在app.js文件中的launch方法中調用下面兩個方法
StatusBar.backgroundColorByName("black"); //設置背景狀態欄的背景顏色 ,自己自己的主題顏色設置顏色 StatusBar.overlaysWebView(false); //不被webView覆蓋
