解决Cordova开发的iOS的app界面被状态栏覆盖

解决方法如下:

一:在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];
    
}

二:

  1. 打开http://cordova.apache.org/plugins,
  2. 搜索statusbar
  3. cmd进入cordova目录使用cordova plugin add cordova-plugin-statusbar
  4. 添加成功后然后,在app.js文件中的launch方法中调用下面两个方法
    StatusBar.backgroundColorByName("black"); //设置背景状态栏的背景颜色 ,自己自己的主题颜色设置颜色      
    StatusBar.overlaysWebView(false);   //不被webView覆盖                                                 
原文地址:https://www.cnblogs.com/interdrp/p/9039009.html