masked the password input to UITextfield
I hope to mask the text input to UITextField
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]initWithS开发者_如何学Pythontring:@"*"] autorelease];
return YES;
}
UITextField
supports password input itself, just set its secureTextEntry
property to YES
. (see UITextInputTraits
protocol docs for more details)
精彩评论