开发者

masked the password input to UITextfield

开发者 https://www.devze.com 2022-12-27 06:11 出处:网络
I hope to mask the text input to UITextField as: \"ABCDE\" to \"*****\" below are my codes without function

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)

0

精彩评论

暂无评论...
验证码 换一张
取 消