UITextField secureTextEntry toggle set incorrect font : <p>I have an <code>UITextField</code> which I use as a password field. It has by default <code>secureTextEntry</code> set to <code>true</code>. 
I also have a <code>UIButton</code> to toggle the show/hide of the password.</p>

<p>When I change the textfield from <code>secureTextEntry</code> set to <code>true</code> to <code>false</code>, the font gets weird. Seems it becomes Times New Roman or similar.</p>

<p>I have tried re-setting the font to system with size 14, but it didn't change anything. </p>

<p>Example of what happens (with initial <code>secureTextEntry</code> set to <code>true</code>):
<a href="https://i.stack.imgur.com/ab5sy.gif" rel="noreferrer"><img src="https://i.stack.imgur.com/ab5sy.gif" alt="Example"></a></p>

<p>My code:</p>

<pre><code>@IBAction func showHidePwd(sender: AnyObject) {
    textfieldPassword.secureTextEntry = !textfieldPassword.secureTextEntry

    // Workaround for dot+whitespace problem
    if !textfieldPassword.secureTextEntry {
        let tempString = textfieldPassword.text
        textfieldPassword.text = nil
        textfieldPassword.text = tempString
    }
    textfieldPassword.font = UIFont.systemFontOfSize(14)

    if textfieldPassword.secureTextEntry {
        showHideButton.setImage(UIImage(named: "EyeClosed"), forState: .Normal)
    } else {
        showHideButton.setImage(UIImage(named: "EyeOpen"), forState: .Normal)
    }

    textfieldPassword.becomeFirstResponder()
}
</code></pre>
