From 4468bd4c0abdd5418df1be752871b0540e4a2056 Mon Sep 17 00:00:00 2001 From: Graham Chance Date: Thu, 21 Feb 2019 16:02:24 -0500 Subject: [PATCH] fixed when editing ended event is fired --- Classes/MMNumberKeyboard.m | 20 ++++++++++---------- MMNumberKeyboard.podspec | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Classes/MMNumberKeyboard.m b/Classes/MMNumberKeyboard.m index 78ff9ab..5220606 100644 --- a/Classes/MMNumberKeyboard.m +++ b/Classes/MMNumberKeyboard.m @@ -279,11 +279,11 @@ - (void)_buttonInput:(UIButton *)button // Handle backspace. else if (keyboardButton == MMNumberKeyboardButtonBackspace) { BOOL shouldDeleteBackward = YES; - + if ([delegate respondsToSelector:@selector(numberKeyboardShouldDeleteBackward:)]) { shouldDeleteBackward = [delegate numberKeyboardShouldDeleteBackward:self]; } - + if (shouldDeleteBackward) { [keyInput deleteBackward]; } @@ -298,6 +298,11 @@ - (void)_buttonInput:(UIButton *)button } if (shouldReturn) { + id keyInput = self.keyInput; + if ([keyInput isKindOfClass:[UITextField class]]) { + UITextField * textField = (UITextField *)keyInput; + [textField sendActionsForControlEvents:UIControlEventEditingDidEndOnExit]; + } [self _dismissKeyboard:button]; } } @@ -408,11 +413,6 @@ - (void)_dismissKeyboard:(id)sender { id keyInput = self.keyInput; - if ([keyInput isKindOfClass:[UITextField class]]) { - UITextField * textField = (UITextField *)keyInput; - [textField sendActionsForControlEvents:UIControlEventEditingDidEndOnExit]; - } - if ([keyInput isKindOfClass:[UIResponder class]]) { [(UIResponder *)keyInput resignFirstResponder]; } @@ -774,14 +774,14 @@ + (UIImage *)_keyboardImageNamed:(NSString *)name if (!resource.length) { return nil; } - + NSBundle *bundle = [NSBundle bundleForClass:[self class]]; NSString *resourcePath = [bundle pathForResource:resource ofType:extension]; - + if (resourcePath.length) { return [UIImage imageWithContentsOfFile:resourcePath]; } - + return [UIImage imageNamed:resource]; } diff --git a/MMNumberKeyboard.podspec b/MMNumberKeyboard.podspec index e6845a7..8c221c9 100644 --- a/MMNumberKeyboard.podspec +++ b/MMNumberKeyboard.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "MMNumberKeyboard" - s.version = "0.2.1.4" + s.version = "0.2.1.5" s.summary = "A simple keyboard to use with numbers and, optionally, a decimal point." s.homepage = "http://www.matmartinez.net/" s.license = { :type => 'MIT', :file => 'LICENSE' }