diff --git a/RETableViewManager/Cells/RETableViewCreditCardCell.m b/RETableViewManager/Cells/RETableViewCreditCardCell.m index 1582b60..6216c95 100644 --- a/RETableViewManager/Cells/RETableViewCreditCardCell.m +++ b/RETableViewManager/Cells/RETableViewCreditCardCell.m @@ -302,4 +302,17 @@ static inline NSString * RECreditCardType(NSString *creditCardNumber) return YES; } +-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { + if (textField == self.expirationDateField) { + if (range.location == 1) { + NSInteger month = [NSString stringWithFormat:@"%@%@", self.expirationDateField.text, string].integerValue; + if (month > 12) { + return NO; + } + } + } + + return YES; +} + @end