-(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
本文提供了一个Objective-C的方法,用于限制UITextField中输入的字符数量不超过12个。通过使用NSMutableString替换指定范围内的字符来实现这一功能。
1065

被折叠的 条评论
为什么被折叠?



