-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{
if (textField.keyboardType == UIKeyboardTypeNumberPad)
{
if (!(textField.text.length<10||[string isEqualToString:@""])||[string rangeOfCharacterFromSet:[[NSCharacterSet decimalDigitCharacterSet] invertedSet]].location != NSNotFound)
{
return NO;
}
}
return YES;
}
No comments:
Post a Comment