Reputation: 4654
I am making a user registration page. I noticed that there is an auto generated key symbol on top the keyboard for all the UITextField
except the first one. That key leads to the stored passwords secured by TouchID. It doesn't make much sense to have it for my "Re-enter email" text field. Is there a way to get rid of it? I just used a regular UITextField
with either .keyboardType
set to .emailAddress
or .isSecureTextEntry = true
.
However, if I jump straight from the first text field to the last, a plain keyboard is shown without the bar on top. Is this the expected behavior?
Upvotes: 0
Views: 1473
Reputation: 38833
I´m not sure that you can remove the key only, what you could do in your textFieldDidBeginEditing
is to set the autocorrectionType
for your keyboard.
Something like this:
class ViewController: UIViewController, UITextFieldDelegate {
@IBOutlet weak var textField: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
textField.delegate = self
}
func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool {
if textField.tag == 0 {
textField.autocorrectionType = .no
} else {
textField.autocorrectionType = .default
}
return true
}
}
This will hide the suggestion bar when you´re on particular textfields. Set the tags for your password textfields and add these tags in the if-statement and you´ll hide the suggestion bar since you done need it there anyway,
Upvotes: 1