HomeiOS Developmentios - How you can replace/reload auto fill ideas for UITextField when...

ios – How you can replace/reload auto fill ideas for UITextField when altering textContentType of that textual content subject?


I’ve easy definition of UITextField in my UIView:

let textField: UITextField = {
    let textField = UITextField()
    textField.font = UIFont.poppinsRegular.withSize(18)
    textField.textColor = .black
    textField.textAlignment = .left
    textField.tintColor = .black
    return textField
}()

and on person reactions I modify it relying on person wants like this:

func showTextField(
    placeholder: String?,
    keyboardType: UIKeyboardType,
    textContentType: UITextContentType?,
    isSecureTextEntry: Bool
) {
    textField.placeholder = placeholder
    textField.keyboardType = keyboardType
    textField.textContentType = textContentType
    textField.isSecureTextEntry = isSecureTextEntry
    textField.reloadInputViews()
    textField.becomeFirstResponder()
}

and for instance, I modify from .postalCode to .givenName and it doesnt work till I faucet on it. Why? What to do to replace it mechanically?

Have a look at the screenshots:

That is what I can see once I first show my UITextField and set .postalCode textContentType. I can fill it, and it’s okay.

enter image description here

However once I fill it, there auto fill needs to be reloaded to .givenName, however it doesnt need to be refreshed. It stays from earlier kind. Why?

enter image description here

Once I merely faucet on that UITextField it’s appropriately refreshed. What can I do to refresh it with out tapping on textual content subject?

enter image description here

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments