- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
if (range.length + range.location > textField.text.length) {
return NO;
}NSUInteger length = textField.text.length + string.length - range.length;
return length <= 6;//这里可以更改为需要的位数
return YES;
}
网友评论