【问题标题】: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