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?
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
As describec here, you can now add the property
KeyboardDisplayRequiresUserAction=NO;
to your Cordova.plist file and then just call
$(el).focus();
来源:https://stackoverflow.com/questions/13002376/show-keyboard-automatically-with-focus-event-in-uiwebview-using-trigger-io-pho