How can I change the dots to another character on password field in iOS Swift
ios, passwords, swift
Solution
2 options here:
- Use a normal textfield without the secure input option. When a user enters a character, save it to a string variable, and replace it in the textfield with the character you wish to present instead of the bullets.
Here's the code (will show the password as $$$$):
var password: String = ""
func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool
{
password = password+string
textField.text = textField.text+"$"
println("\(password)")
return false
}
- check out the answers here: UITextField secureTextEntry bullets with a custom font?
Problem
I have a Text Field and I would like to replace the default dot character to something else when the password is hidden. Is there any way to do this easily?