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;
}

原文地址:https://www.cnblogs.com/qingjoin/p/3508306.html