iOS 13 仅在从上一个文本字段切换后偶尔提示强密码
iOS 13 only occasionally suggests a strong password after switching from previous textfield
我正在为 iOS 13 上的 UITextField 添加强密码生成而苦苦挣扎。尽管将 textContentType
添加到 [=,但它对我的主要新密码字段根本不起作用13=]。但是,仅当我在主密码字段后 select 它才适用于我的确认密码字段。
这是这些文本字段的设置,发生在控制器的 init
.
中
valueTextfield.font = .boldSystemFont(ofSize: 28)
valueTextfield.autocapitalizationType = .none
valueTextfield.autocorrectionType = .no
valueTextfield.textColor = .black
valueTextfield.textAlignment = .center
valueTextfield.borderStyle = .none
valueTextfield.tintColor = .primary
valueTextfield.sizeToFit()valueTextfield.textContentType = .newPassword
valueTextfield.placeholder = "Password".localized
confirmationTextField.font = .boldSystemFont(ofSize: 28)
confirmationTextField.textColor = .black
confirmationTextField.textAlignment = .center
confirmationTextField.autocapitalizationType = .none
confirmationTextField.autocorrectionType = .no
confirmationTextField.textContentType = .newPassword
confirmationTextField.borderStyle = .none
confirmationTextField.tintColor = .primary
confirmationTextField.placeholder = "Confirm".localized
即使向空白控制器添加文本字段也无济于事。那是 iOS 13 错误吗?
确保您已正确设置 UITextField
的这 3 个属性,以便密码自动填充工作:
textField.isSecureTextEntry = true
textField.autocapitalizationType = .none
textField.textContentType = .password
最重要的是,启用密码自动填充:
Settings > Passwords & Accounts > AutoFill Passwords
显然,目前无法使用我希望自动生成密码的方式。
要使强密码建议发挥作用,用户名文本字段应与密码文本字段在同一屏幕上。
这很奇怪,但在研究了 Twitter 等应用程序后,我发现它们都没有针对单个密码文本字段的强密码建议。目前尚不清楚这是错误还是功能。
我将不得不手动重新实现此功能。
我正在为 iOS 13 上的 UITextField 添加强密码生成而苦苦挣扎。尽管将 textContentType
添加到 [=,但它对我的主要新密码字段根本不起作用13=]。但是,仅当我在主密码字段后 select 它才适用于我的确认密码字段。
这是这些文本字段的设置,发生在控制器的 init
.
valueTextfield.font = .boldSystemFont(ofSize: 28)
valueTextfield.autocapitalizationType = .none
valueTextfield.autocorrectionType = .no
valueTextfield.textColor = .black
valueTextfield.textAlignment = .center
valueTextfield.borderStyle = .none
valueTextfield.tintColor = .primary
valueTextfield.sizeToFit()valueTextfield.textContentType = .newPassword
valueTextfield.placeholder = "Password".localized
confirmationTextField.font = .boldSystemFont(ofSize: 28)
confirmationTextField.textColor = .black
confirmationTextField.textAlignment = .center
confirmationTextField.autocapitalizationType = .none
confirmationTextField.autocorrectionType = .no
confirmationTextField.textContentType = .newPassword
confirmationTextField.borderStyle = .none
confirmationTextField.tintColor = .primary
confirmationTextField.placeholder = "Confirm".localized
即使向空白控制器添加文本字段也无济于事。那是 iOS 13 错误吗?
确保您已正确设置 UITextField
的这 3 个属性,以便密码自动填充工作:
textField.isSecureTextEntry = true
textField.autocapitalizationType = .none
textField.textContentType = .password
最重要的是,启用密码自动填充:
Settings > Passwords & Accounts > AutoFill Passwords
显然,目前无法使用我希望自动生成密码的方式。 要使强密码建议发挥作用,用户名文本字段应与密码文本字段在同一屏幕上。 这很奇怪,但在研究了 Twitter 等应用程序后,我发现它们都没有针对单个密码文本字段的强密码建议。目前尚不清楚这是错误还是功能。 我将不得不手动重新实现此功能。