【发布时间】:2020-12-11 22:45:51
【问题描述】:
如何检测用户是否将某些内容粘贴到 UITextField?
我在网上和 StackOverflow 上找到的所有答案都与 UITextViews 相关。
【问题讨论】:
-
这个answer 是针对 UITextField 的,即使问题是关于 UITextView。
如何检测用户是否将某些内容粘贴到 UITextField?
我在网上和 StackOverflow 上找到的所有答案都与 UITextViews 相关。
【问题讨论】:
您只需要在您的 UITextField 委托上覆盖 UIResponderStandardEditActions 粘贴方法:
override func paste(_ sender: Any?) {
print("do someting")
super.paste(sender)
}
【讨论】: