开发者

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)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜