简体   繁体   English

如何知道何时点击 WKWebView 中的 TextField

[英]How to know when TextField in a WKWebView is Tapped

In this Apple doc about Keyboards , the first sentence says:在这个关于 Keyboards 的 Apple 文档中,第一句话说:

When users touch a text field, a text view, or a field in a web view , the system displays a keyboard.当用户触摸文本字段、文本视图或web 视图中的字段时,系统会显示一个键盘。

Are there any methods or KVO observers to know when a user starts/stops typing in a field in WKWebView ?是否有任何方法或 KVO 观察者可以知道用户何时开始/停止在 WKWebView 中输入字段

For example, when interacting with a regular UITextField, if I want to know when a user starts and stops typing, these two methods are available, but WKWebView doesn't have anything like these比如和一个普通的UITextField交互时,如果我想知道用户什么时候开始和停止打字,这两种方法都可以,但是WKWebView没有这些

func textFieldDidBeginEditing(_ textField: UITextField) {
}

func textFieldDidEndEditing(_ textField: UITextField) {

}

I don't need the keyboardWillShow/Hide notifications.我不需要keyboardWillShow/Hide 通知。 I need some delegate methods or a KVO for the textFields specific to WKWebView .对于特定于 WKWebView的 textFields,我需要一些委托方法或 KVO。

Unfortunately WKWebView does't have delegate methods that gets called when web form inputs are triggered.不幸的是,WKWebView 没有在触发 web 表单输入时调用的委托方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM