How can I change a secure UITextField
text (which is simply a bunch of dots) to (*) asterisk characters like in the image below?
You can set it programmatically by
[textField setSecureTextEntry:YES];
or in IB (secured checkbox at the bottom)
You could also try simply implementing your own "secure text field".
Simply create a normal, non-secure text field, and link it's "Editing Changed" action with a method in your view controller.
Then within that method you can take the new characters every time the text is changed, and add them to a private NSString property, and then set the textField's .text property to a string with just asterisks in it (or any other character if you prefer).
Update: as noted by hayesk below, this solution is no longer ideal, as the introduction of third-party keyboards exposes input on any non-secure text fields to the third-party application, risking them collecting that information, and/or adding it to the autocorrect database.
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