iOS 模拟器中的奇怪离子行为

odd Ionic behavior in iOS simulator

我正在开发的一个 Ionic 应用程序在 iOS 模拟器 (Xcode 7.2.1) 中 运行 时有一些奇怪的行为。我的登录屏幕通常 运行 看起来像:

但是,在编辑用户名字段时,我在底部看到某种工具栏弹出窗口:

更糟糕的是,当我转到密码字段时:

我一开始以为这可能是对付原生的WebView,但它只发生在模拟器中。在实际设备上或通过 ionic serve 时不是 运行。知道这里发生了什么吗?为什么会有这种奇怪的行为?

编辑

此外,即使我已使用 Ionic 设置启动画面,该应用程序也会以默认 Cordova 启动画面启动。即便如此,它应该显示 Ionic 启动而不是 Cordova。

编辑#2 很多时候,Cordova 状态栏无法正常工作,我的状态栏是黑色而不是白色。

虽然这对您来说在 iOS 模拟器中看起来很奇怪,而对我来说在 Chrome 的设备模拟器开发工具中看起来很奇怪,但它是“期望的行为”离子。

Ionic 在设计时考虑到了移动焦点,因此在模拟移动设备时,它们会隐藏元素以模拟本机键盘。

Ionic 写了 a blog post 关于这个,事实上:

Getting the keyboard to play nicely with the web layer was challenging for several reasons. Probably the biggest issue is the variation in behavior across devices and platforms when the keyboard is shown.

In iOS, not only does the web view resize differently when the keyboard shows in versions 6.1, 7.0, and 7.1, but it is affected differently, and sometimes completely oppositely, by including or excluding the viewport meta tag. Throw support for tablets and landscape orientation into the mix and trying to make every scenario on every device work nicely can have you quickly creating three new issues for every one you fix.

博客 post 继续说他们为 Cordova 编写了一个键盘插件,应该可以更快更准确地执行与键盘相关的隐藏和元素更改。你可以发现 GitHub repo here.