如何删除iOS上Ionic Webview顶部的空间?

hea*_*mon 7 javascript css ios cordova ionic-framework

这是我第一次使用Ionic开发.

我试图删除我的应用程序中的状态栏.现在,iPad应用程序的状态栏已被删除.但是,我的Iconic视图顶部仍有一个空格(我认为其大小与状态栏相同).我已经使用此代码设置了Javascript文件以隐藏状态栏,但它无法正常工作.

ionic.Platform.ready(function() {
// hide the status bar using the StatusBar plugin
StatusBar.hide();
// ionic.platform.fullScreen();
});
Run Code Online (Sandbox Code Playgroud)

我怎样才能解决这个问题或者我做错了什么?谢谢.

这是在Web浏览器和iOS模拟器之间进行比较的图像

Mar*_*son 6

我有同样的问题.我用了:

ionic.Platform.ready(function() {
  //hide the status bar using the StatusBar plugin
  if(window.StatusBar) {
    // org.apache.cordova.statusbar required
    StatusBar.hide();
    ionic.Platform.fullScreen();
  }
});
Run Code Online (Sandbox Code Playgroud)

ionic.Platform.fullScreen(); 是我项目中的事情.这消除了顶部的空间.


Epo*_*okK 1

您是否安装了这样的状态栏插件:

$ cordova plugin add org.apache.cordova.statusbar
Run Code Online (Sandbox Code Playgroud)

只有在此之后,您才能删除状态栏:

angular.module('myApp', ['ionic'])

.controller('MyCtrl', function($scope) {
  ionic.Platform.ready(function() {
    // hide the status bar using the StatusBar plugin
    StatusBar.hide();
  });
});
Run Code Online (Sandbox Code Playgroud)