【问题标题】:ChildBrowser resizes Main viewChildBrowser 调整主视图的大小
【发布时间】:2012-10-12 00:58:30
【问题描述】:

我有一个包含 ChildBrowser 插件的 Cordova 2.1.0 项目。现在,当我关闭 ChildBrowser 时,我的键盘和选择菜单位于屏幕下方,仅显示下一个/上一个/完成按钮。有谁知道如何解决这个问题?看到有人说要加

self.view.frame = [[UIScreen mainScreen] applicationFrame];

mainviewController 中的viewWillAppear 但是这并没有这样做。

见过https://github.com/phonegap/phonegap-plugins/issues/815,但没有找到解决方案。

【问题讨论】:

  • 你找到解决这个问题的办法了吗?

标签: ios cordova childbrowser


【解决方案1】:

以下代码对我有用:

[theWebView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:
  @"document.querySelector('meta[name=viewport]').setAttribute('content', 'width=%d;', false); ", (int)theWebView.frame.size.width]];
[theWebView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:
  @"document.querySelector('meta[name=viewport]').setAttribute('content', 'height=%d;', false); ", (int)theWebView.frame.size.height]];

在 webVieDidFinishLoad 中。对我来说工作得很好:)

参考:https://stackoverflow.com/a/6104537/1000985

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-09-29
    • 2011-03-18
    • 1970-01-01
    • 2013-07-26
    • 1970-01-01
    • 1970-01-01
    • 2011-05-15
    • 1970-01-01
    相关资源
    最近更新 更多