使用 Trigger.IO/PhoneGap 在 UIWebView 中使用 focus() 事件自动显示键盘 [英] Show keyboard automatically with focus() event in UIWebView using Trigger.IO/PhoneGap

查看:23
本文介绍了使用 Trigger.IO/PhoneGap 在 UIWebView 中使用 focus() 事件自动显示键盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据推测,这在 iOS 6 之后是不可能的,您可以在其中设置 UIWebView 的keyboardDisplayRequiresUserAction = NO.

Supposedly, this has not been possible since iOS 6 where you can set the UIWebView's keyboardDisplayRequiresUserAction = NO.

我正在使用 html 5 webview (Trigger.IO) 并构建本机插件,但难以抓住 UIWebView 实例.

I'm using a html 5 webview (Trigger.IO) and building a native plugin but am having difficulty grabbing hold of the UIWebView instance.

我如何抓住 webview 以便我可以简单地执行以下操作:

How do I grab hold of the webview so I can simply do the following:

mywebview.keyboardDisplayRequiresUserAction = NO;

可能真的很简单..我错过了什么?

Probably really simple.. what am I missing?

推荐答案

对 UIWebView 的访问不是我们在当前版本的插件中正确公开的东西(但我们很快就会支持).现在,如果您想尝试一下,可以添加

Access to the UIWebView isn't something we properly expose in the current version of plugins (but is something we will support soon). For now if you want to try it out you can add

extern UIWebView *webView;

到插件文件的顶部,这将使变量 webView 在您的 API 方法中可用.不过这很快就会停止工作,所以我建议您现在只使用它来测试.

to the top of your plugin file, which will make the variable webView available in your API methods. This will stop working very soon though so I recommend you only use this to test things out for now.

2012 年 10 月更新:

应用程序的 Web 视图现在通过 ForgeApp 公开:http://docs.trigger.io/en/v1.4/_static/native/ios/Classes/ForgeApp.html#//api/name/webView

The app's web view is now exposed via ForgeApp: http://docs.trigger.io/en/v1.4/_static/native/ios/Classes/ForgeApp.html#//api/name/webView

例如:

[ForgeApp sharedApp].webView

这篇关于使用 Trigger.IO/PhoneGap 在 UIWebView 中使用 focus() 事件自动显示键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆