gpt4 book ai didi

textfield - SwiftUI TextField 建议没有 textContentType 的 OTP 代码

转载 作者:行者123 更新时间:2023-12-05 07:06:21 28 4
gpt4 key购买 nike

使用 TextField View 时,我的 SwiftUI 项目出现奇怪的行为。

使用以下代码,TextField textContentType 设置为 nil(或 .none,或 UITextContentType.init(rawValue : "")) 但键盘提示我一个 OTP 代码(如果最近收到,例如在之前的 View 中)。为什么?

我已经尝试了其他有效的 textContentType,例如 .name.address,......但没有成功(仅 textContentType .password.newPassword 禁用 OTP 建议)。

struct TestView: View {
@State private var text: String = ""

var body: some View {
TextField("", text: $text)
.keyboardType(.numberPad)
.textContentType(nil) // or .none, or UITextContentType.init(rawValue: "")
}
}

对于 UIKit 项目,UITextField 按预期工作(无键盘建议)。有什么想法吗?

谢谢

最佳答案

显然这是 UIKit 的遗留错误。同样的问题。

感谢您提供 .password 的提示

遗憾的是提示填写密码

关于textfield - SwiftUI TextField 建议没有 textContentType 的 OTP 代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62532384/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com