Show keyboard automatically with focus() event in

2019-02-15 09:45发布

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

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

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?

2条回答
ら.Afraid
2楼-- · 2019-02-15 10:07

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;

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.

Update Oct 2012:

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

E.g.:

[ForgeApp sharedApp].webView
查看更多
该账号已被封号
3楼-- · 2019-02-15 10:25

As describec here, you can now add the property

KeyboardDisplayRequiresUserAction=NO;

to your Cordova.plist file and then just call

$(el).focus();
查看更多
登录 后发表回答