密码字段的键盘从 azerty 切换到 qwerty(有时)仅在 iOS 12
Password field's keyboard switches from azerty to qwerty (sometimes) only on iOS 12
我在 Swift 4
编写了一个 iOS
应用程序,我是法国人,所以我在法国 language/french 地区使用手机 phone。
使用 iOS 12 设备,我的登录页面上的密码字段工作得很好(使用保存的密码自动登录甚至可以工作,我没有做任何事情来让它工作),但是我的注册页面,该字段使我的键盘从 AZERTY 切换到 QWERTY。
我的 phone 设置中只有 AZERTY 键盘,所有 iOS 12 台设备都会出现这种情况,而不仅仅是我的...
我在代码中做的唯一一件事:(我的 UIView
文件名为 RegisterView.swift)
fieldPwd = UITextField()
fieldPwdConfirm = UITextField()
fieldPwd.isSecureTextEntry = true
fieldPwdConfirm.isSecureTextEntry = true
这个问题有解决办法吗?谢谢!
我已经为我的项目找到了解决方案,也许它可以帮助某人。
我注意到了:
- 在我的登录页面(有 1 个安全
UITextField
),键盘是 AZERTY
- 在我的登录页面(有 2 个安全
UITextField
),键盘是 QWERTY
- 在我的帐户页面(有 2 个安全
UITextField
),键盘是 AZERTY
经过一段时间对登录页面和帐户页面的比较,我发现在我的帐户页面中,安全文本字段之前的文本字段是 .numberPad
文本字段。
所以在我的登录 xib 文件中,我将我的安全文本字段设置为 .numberPad
,并在 textFieldDidBeginEditing
中将它们设置为 .default
。并在 textFieldDidEndEditing
中再次返回 .numberPad
,因为如果没有,键盘将第二次出现在 QWERTY 中。现在,我的安全文本字段在 AZERTY 中。
func textFieldDidBeginEditing(_ textField: UITextField) {
if ( textField == pwdTextField || textField == pwd2TextField ) {
textField.keyboardType = .default;
}
// do other stuffs
}
func textFieldDidEndEditing(_ textField: UITextField) {
if ( textField == pwdTextField || textField == pwd2TextField ) {
textField.keyboardType = .numberPad;
}
// do other stuffs
}
@.@
这是因为应用程序的默认区域设置。
从 info.plist.
中删除以下设置
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>fr</string>
...
</dict>
干杯...
事实上,使用 2 个密码内容类型文本字段(例如,当用户必须确认新密码时)会导致键盘出现问题。如此处所述,键盘设置为 QWERTY,而它应该是 AZERTY(使用我使用的语言),当我从一个文本字段转到另一个文本字段时,键盘会闪烁。
实际上,不需要为密码文本字段设置此内容类型,对两个文本字段使用“新密码”内容类型就可以正常工作,并且不会造成键盘问题。
同样的问题:
https://github.com/xlbs-rm/ios-demo
在此处填写错误报告:https://feedbackassistant.apple.com/日期 2020-07-31
Apple 暂无回应
iOS 13.5.1、13.7、12.4.3 上的问题
连接设备(调试)、模拟器、TestFlight Alpha 版本(针对 iTunesConnect 用户)、TestFlight Beta 版本(Apple 批准的 TestFlight 版本)的问题
唯一的解决方案是删除第二个密码字段!
想法 #2 textContentType = .oneTimeCode
此处建议:
if #available(iOS 12.0, *) {
tfPassword.textContentType = .oneTimeCode
}
- 不工作
- 未删除警告“无法显示应用程序的自动强密码...”
想法 #3 删除 CFBundleDevelopmentRegion
- 不工作
想法 #4 结束 UITextField,覆盖 textInputMode return 一个具有正确语言的
类似于此处:
- 不工作
解法:
if #available(iOS 12.0, *) {
passInput.textContentType = .newPassword
}
实施:UITextFieldDelegate
public func textFieldDidBeginEditing(_ textField: UITextField) {
if exchangeResponder == false {
exchangeResponder = true
firstnameInput.becomeFirstResponder()
textField.becomeFirstResponder()
exchangeResponder = false
}
}
passInput.delegate = self
pass2Input.delegate = self
现在我可以在所有字段之间移动,并且每次都能使用德语键盘!
我在 Swift 4
编写了一个 iOS
应用程序,我是法国人,所以我在法国 language/french 地区使用手机 phone。
使用 iOS 12 设备,我的登录页面上的密码字段工作得很好(使用保存的密码自动登录甚至可以工作,我没有做任何事情来让它工作),但是我的注册页面,该字段使我的键盘从 AZERTY 切换到 QWERTY。
我的 phone 设置中只有 AZERTY 键盘,所有 iOS 12 台设备都会出现这种情况,而不仅仅是我的...
我在代码中做的唯一一件事:(我的 UIView
文件名为 RegisterView.swift)
fieldPwd = UITextField()
fieldPwdConfirm = UITextField()
fieldPwd.isSecureTextEntry = true
fieldPwdConfirm.isSecureTextEntry = true
这个问题有解决办法吗?谢谢!
我已经为我的项目找到了解决方案,也许它可以帮助某人。
我注意到了:
- 在我的登录页面(有 1 个安全
UITextField
),键盘是 AZERTY - 在我的登录页面(有 2 个安全
UITextField
),键盘是 QWERTY - 在我的帐户页面(有 2 个安全
UITextField
),键盘是 AZERTY
经过一段时间对登录页面和帐户页面的比较,我发现在我的帐户页面中,安全文本字段之前的文本字段是 .numberPad
文本字段。
所以在我的登录 xib 文件中,我将我的安全文本字段设置为 .numberPad
,并在 textFieldDidBeginEditing
中将它们设置为 .default
。并在 textFieldDidEndEditing
中再次返回 .numberPad
,因为如果没有,键盘将第二次出现在 QWERTY 中。现在,我的安全文本字段在 AZERTY 中。
func textFieldDidBeginEditing(_ textField: UITextField) {
if ( textField == pwdTextField || textField == pwd2TextField ) {
textField.keyboardType = .default;
}
// do other stuffs
}
func textFieldDidEndEditing(_ textField: UITextField) {
if ( textField == pwdTextField || textField == pwd2TextField ) {
textField.keyboardType = .numberPad;
}
// do other stuffs
}
@.@
这是因为应用程序的默认区域设置。 从 info.plist.
中删除以下设置<dict>
<key>CFBundleDevelopmentRegion</key>
<string>fr</string>
...
</dict>
干杯...
事实上,使用 2 个密码内容类型文本字段(例如,当用户必须确认新密码时)会导致键盘出现问题。如此处所述,键盘设置为 QWERTY,而它应该是 AZERTY(使用我使用的语言),当我从一个文本字段转到另一个文本字段时,键盘会闪烁。
实际上,不需要为密码文本字段设置此内容类型,对两个文本字段使用“新密码”内容类型就可以正常工作,并且不会造成键盘问题。
同样的问题: https://github.com/xlbs-rm/ios-demo
在此处填写错误报告:https://feedbackassistant.apple.com/日期 2020-07-31
Apple 暂无回应 iOS 13.5.1、13.7、12.4.3 上的问题 连接设备(调试)、模拟器、TestFlight Alpha 版本(针对 iTunesConnect 用户)、TestFlight Beta 版本(Apple 批准的 TestFlight 版本)的问题
唯一的解决方案是删除第二个密码字段!
想法 #2 textContentType = .oneTimeCode
此处建议:
if #available(iOS 12.0, *) {
tfPassword.textContentType = .oneTimeCode
}
- 不工作
- 未删除警告“无法显示应用程序的自动强密码...”
想法 #3 删除 CFBundleDevelopmentRegion
- 不工作
想法 #4 结束 UITextField,覆盖 textInputMode return 一个具有正确语言的
类似于此处:
- 不工作
解法:
if #available(iOS 12.0, *) {
passInput.textContentType = .newPassword
}
实施:UITextFieldDelegate
public func textFieldDidBeginEditing(_ textField: UITextField) {
if exchangeResponder == false {
exchangeResponder = true
firstnameInput.becomeFirstResponder()
textField.becomeFirstResponder()
exchangeResponder = false
}
}
passInput.delegate = self
pass2Input.delegate = self
现在我可以在所有字段之间移动,并且每次都能使用德语键盘!