I code an iOS
App in Swift 4
, I'm french so I work with mobile phone in french language/french region.
With an iOS 12 device, my password field on my login page works perfectly fine (the auto-login with saved password even works and I didn't do anything to get this working), but on my register page, the field makes my keyboard switch from AZERTY to QWERTY.
There is just the AZERTY keyboard in my phone settings, and it happens with all the iOS 12 devices not just mine...
The only thing I do in code : (my UIView
file is named RegisterView.swift)
fieldPwd = UITextField()
fieldPwdConfirm = UITextField()
fieldPwd.isSecureTextEntry = true
fieldPwdConfirm.isSecureTextEntry = true
Is there any fix to this issue ? Thanks !
I've found a solution for my project, maybe it can help someone.
I've noticed that :
UITextField
), keyboard was AZERTYUITextField
), keyboards were QWERTYUITextField
), keyboards were AZERTYAfter a while of comparison between signin and account pages, I've realized that in my account page, the textfield before secure textfield was a .numberPad
textfield.
So in my login xib file, I've set my secure textfields to .numberPad
and I set them to .default
in textFieldDidBeginEditing
. And back to .numberPad
again in textFieldDidEndEditing
because if not, keyboards appeared in QWERTY the second time. Now, my secure textfields are in 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
}
@.@
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With