Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 8 - username UITextField secures entry when becoming first responder AFTER the password text field

I encountered an issue with a classic configuration: username/password textfields. Nothing special, just 2 UITextFields, one with "Secure Text Entry" checked, that's it.

When I tap on the username textfield, it is normal. Then I tap on the password textfield, the text is secured (big dots). And when I tap again on the username textfield, the text of both textfields is secured!

If I tap outside of the password textfield before tapping again on the username password, the text is still secured. However, if after that, I tap outside of the username textfield and then on the username textfield again, the text is not secured. Also, if I change the text of the username textfield while it is secured, it becomes normal again.

Bug occurs on iOS8 (not iOS7).

Any idea? Thanks!

like image 664
APE Avatar asked Oct 20 '14 00:10

APE


1 Answers

My colleague added that and it worked

-(void)textFieldDidBeginEditing:(UITextField *)textField
{
    if (textField == self.usernameText)
    {
        self.usernameText.secureTextEntry = YES;
        self.usernameText.secureTextEntry = NO;
    }
}
like image 122
APE Avatar answered Oct 29 '22 16:10

APE