Our customers want a Textfield
for a Password which is not showing any character while typing.
Is there any Setting in iOS to activate this behaviour or is it possible to hide also the last typed character using the secureTextEntry
property on a UITextField
?
If you have a UITextField or UITextView and want to stop users typing in more than a certain number of letters, you need to set yourself as the delegate for the control then implement either shouldChangeCharactersIn (for text fields) or shouldChangeTextIn (for text views).
If you have a UITextField and you want to hide the keyboard when the user is pressing the return key, use the textFieldShouldReturn function. Be sure you have set the textField. delegate = self in your viewDidLoad() function.
An object that displays an editable text area in your interface.
You can set your view controller as delegate for your text field, and add the following method, this will not allow the text field to show that last character:
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
if (textField == self.pinTextField) {
NSString *currentText = textField.text;
NSString *newText = [currentText stringByReplacingCharactersInRange:range withString:string];
textField.text = newText;
return NO;
}
return YES;
}
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