tags:

views:

29

answers:

1

Hello everyone

I hope to mask the text input to UITextFiled as:

"ABCDE" to
"*****"

below are my codes without function

- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
   int l=[textField.text length];
   range=NSMakeRange(1, l );
   string=[[[NSString alloc]initWithString:@"*"] autorelease];
   return YES;
}

Welcome any comment

Thanks interdev

+1  A: 

UITextField supports password input itself, just set its secureTextEntry property to YES. (see UITextInputTraits protocol docs for more details)

Vladimir