问题描述
我已将 UITextField 包装在 UIViewRepresentable 中以放入我的 SwiftUI 代码。但是,当我实现此功能时,我无法让具有不同输入法的其他语言正常工作:
func textField(_ textField: UITextField,shouldChangeCharactersIn range: NSRange,replacementString string: String) -> Bool {
if let currentText = textField.text as Nsstring? {
let modifiedText = currentText.replacingCharacters(in: range,with: string)
dispatchQueue.main.async {
self.parent.text = modifiedText
}
}
return true
}
我需要这个函数来将父结构中的绑定设置为 modifiedText (self.parent.text)。但是,当我以这种方式实现它时,我无法再在文本字段中使用 Telex 键盘输入越南语。
什么应该是“được”出现为 dduowjc,就像在普通的英文键盘上打字一样。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)