简体   繁体   English

Cordova:在iOS上屏幕方向从横向更改为纵向时,Inappbrowser中断了UI

[英]Cordova : Inappbrowser breaks UI while Screen orientation changes from landscape to portrait on iOS

I am developing app using cordova 5.4.1, Also I am using latest InAppBrowser plugin. 我正在使用cordova 5.4.1开发应用程序,我也在使用最新的InAppBrowser插件。 Below are the steps to reproduce the issue. 以下是重现该问题的步骤。

  1. Open the URL in InAppBrowser 在InAppBrowser中打开URL
  2. Change the app orientation from portrait to landscape 将应用的方向从纵向更改为横向
  3. Press done button of InAppBrowser and check the app in landscape mode only, you will get some blank portion 按InAppBrowser的完成按钮并仅以横向模式检查应用程序,您将获得一些空白部分

I am using iOS 9.2.1 我正在使用iOS 9.2.1

Please let me know if some one has faced same issue and got fixed. 如果有人遇到相同问题并已解决,请告诉我。

Thank you in advance. 先感谢您。

I know it's a bit late but I wanted to share how I fixed this in case you or anyone else is having this issue. 我知道这有点晚了但是我想分享一下如果你或其他任何人遇到这个问题我如何解决这个问题。

As noted in the issue mentioned in jcesarmobile's comment, it appears that cordova-plugin-statusbar & cordova-plugin-inappbrowser don't play nice together. 正如在jcesarmobile的评论中提到的问题中指出的那样,似乎cordova-plugin-statusbarcordova-plugin-inappbrowser不能很好地配合使用。 The ticket status says resolved, although I'm still having this problem. 票务状态显示已解决,尽管我仍然遇到此问题。 To fix it you can either delete the plugin, or, if you need the plugin then you can add an event listener to hide then show it again on exit: 要修复它,你可以删除插件,或者,如果你需要插件,那么你可以添加一个事件监听器来隐藏然后在退出时再次显示它:

openUrl(url) {
  let ref = cordova.InAppBrowser.open(url, '_blank', options);

  ref.addEventListener('exit', () => {
    StatusBar.hide();
    StatusBar.show();
  })
}

StatusBar.hide() is what fixes the issue. StatusBar.hide()是解决此问题的方法。

EDIT: As noted by René in the comments of this similar issue , a blank column exists in iPad with the fix noted above. 编辑:正如René在此类似问题的评论中所述,iPad中存在一个空白列,其中包含上述修复程序。 In order to completely fix the issue in both iPhone and iPad without having to remove the plugin, wrap the StatusBar.show() call inside a setTimeout of a second: 为了在iPhone和iPad上完全解决此问题而不必删除插件,请将StatusBar.show()调用包装在setTimeout的秒内:

openUrl(url) {
  let ref = cordova.InAppBrowser.open(url, '_blank', options);

  ref.addEventListener('exit', () => {
    StatusBar.hide();

    setTimeout( () => {
      StatusBar.show();
    }, 1000)
  })
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Flutter 应用程序方向从纵向变为横向 - Flutter app orientation changes from portrait to landscape 横向定向屏幕中的ios横向屏幕结果 - ios landscape-orientation screen in portrait orientation results iOS 中纵向和横向的屏幕方向(Objective-C) - Screen Orientation for Portrait and Landscape Orientation in iOS (Objective-C) iOS定向问题从横向到纵向 - iOS Orientation issue from landscape to portrait iOS方向在特定屏幕上同时支持横向和纵向-并非所有屏幕 - iOS Orientation Support both Landscape and Portrait on specific screen - NOT ALL Screens Cordova iOS横向定位 - Cordova iOS landscape orientation iOS:纵向/横向网格 - iOS: grid in portrait / landscape orientation 当用户在 swift 中将屏幕从纵向更改为横向时,如何使滚动视图内的 UIView 适应屏幕方向 - How to make UIView which is inside scrollview adapt to screen orientation when user changes screen from portrait to landscape in swift 离子屏幕方向 Cordova 插件在 iOS 环境中未锁定为纵向模式 - Ionic Screen Orientation Cordova Plugin is not locking to portrait mode in iOS environment 从横向启动应用程序时,锁定IOS中的肖像方向 - Lock Portrait Orientation in IOS on Application Boot from Landscape
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM