我添加了 3 UITextFields
通过输入电子邮件地址格式的用户名、新密码和密码确认来创建新帐户。正如 Enabling Password AutoFill on a Text Input View 中所建议的.我已经像这样配置了用户名字段
userTextField.textContentType = .username
userTextField.keyboardType = .emailAddress
以及像这样的新密码字段
newPasswordTextField.textContentType = .newPassword
confirmPasswordTextField.textContentType = .newPassword
现在,当用户输入电子邮件地址作为用户名时,
newPasswordTextField
预先填充了强密码的建议(如预期),但 confirmPasswordTextField
未填充相同的建议密码。当用户直接点击
newPasswordTextField
在 newPasswordTextField
之前不输入用户名和 confirmPasswordTextField
预先填充了相同的建议密码(也如建议的那样)。我如何将这两种情况结合起来,即在用户输入用户名后,两个密码字段都将预先填充相同的密码?
最佳答案
通过声明 contentType
,我能够自动完成 2 个密码字段。第一个字段为:.password
.username
.password
.newPassword
关于uikit - 在 iOS 12 中通过确认自动填充新密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51946103/