UiTextField 限制输入长度

-(BOOL) textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{
NSMutableString *text = [[moneyInputField.text mutableCopy] autorelease];
[text replaceCharactersInRange:range withString:string];
return [text length] <= 12;
}

你可能感兴趣的:(UITextField)