UIWebView可以使用以下内容:
[webView setKeyboardDisplayRequiresUserAction:NO] Call some JS function
如果webview是WKWebView,你怎么能这样做呢?
相关:How can I get a UIWebView to focus on a form input and bring up the keyboard?
解决方法
在深入研究Webkit源代码几周后,我已经设法通过在WKContentView上调用_startAssistingNode:userIsInteracting:blurPrevIoUsNode:userObject并覆盖userIsInteracting值来实现iOS 9的工作:
伪代码:
swizzle_intercept("WKContentView","_startAssistingNode:userIsInteracting:blurPrevIoUsNode:userObject:",&hackAssist); void hackAssist (id self,SEL _cmd,void* arg0,BOOL arg1,BOOL arg2,id arg3) { ((void (*)(id,SEL,void*,BOOL,id))swizzle_interceptee(hackAssist))(self,_cmd,arg0,TRUE,arg2,arg3); }
干杯!