I have a password field with text “Password” and when user clicks, it gets cleared. Moreover I want to set the type of this textfield as secure but this doesn´t work.
- (void)textFieldDidBeginEditing:(UITextField *)textField{
if ([textField.text isEqualToString:@"Password"] || [textField.text isEqualToString:@"Email"])
{
textField.text = @"";
textField.secureTextEntry = YES;
}
}
set the property in interface builder or when you initialize textfield remove the line from
I think you should set placeholder text as email or password and pre select the secure text entry from interface builder.That’s it…