【发布时间】:2021-11-04 07:54:13
【问题描述】:
点击键盘时自动填充建议无法填充文本字段。这是我在代码中所做的:
textField.keyboardType = .phonePad
textField.textContentType = .telephoneNumber
但是当函数
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool
被称为它只是返回空的replacementString字符串。
设备 ios 版本 14.7
编辑: 我发现如果我不指定/委托
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool
功能一切正常。仍然很困惑为什么。
【问题讨论】:
标签: ios swift uitextfield