Mick Byrne Mick Byrne - 1 year ago 183
iOS Question

Size of bullets in UITextField with secureTextEntry changes size as focus switches when using custom font

I have a

that is using the Museo Sans Rounded 300 font. Everything works fine for normal UITextFields, but when you set the
secureTextEntry = YES
, then there's this disconcerting change to the size of the bullets as the UITextField gets and loses focus (i.e. becomes, and relinquishes, being the first responder).

When the
has focus, the bullets appear to be using the custom font, but once it loses focus they change to being these much bigger (standard size) bullets.

Answer Source

So, the only way I found to combat this was to use the textFieldDidBeginEditing and textFieldDidEndEditing delegate methods, keep track of what was entered in the text field, replace it with a mask of bullets, and disable secureTextEntry. So, when they leave the field, they’re actually just seeing the right number of bullets, rather than their secured text. It’s hacky and messy, but it’ll do for me, perhaps for you, too.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download