//判断是否是数字,不是的话就输入失败- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{NSCharacterSet *cs;cs = [[NSCharacterSet characterSetWithCharactersInString:kAlphaNum] invertedSet];NSString *filtered = [[string componentsSeparatedByCharactersInSet:cs] componentsJoinedByString:@""]; //按cs分离出数组,数组按@""分离出字符串BOOL canChange = [string isEqualToString:filtered];return self.textField.text.length>=5?NO: canChange;