Skip to content

Commit

Permalink
fixed when editing ended event is fired
Browse files Browse the repository at this point in the history
  • Loading branch information
Graham Chance committed Feb 21, 2019
1 parent ed42df8 commit 4468bd4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions Classes/MMNumberKeyboard.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand All @@ -298,6 +298,11 @@ - (void)_buttonInput:(UIButton *)button
}

if (shouldReturn) {
id <UIKeyInput> keyInput = self.keyInput;
if ([keyInput isKindOfClass:[UITextField class]]) {
UITextField * textField = (UITextField *)keyInput;
[textField sendActionsForControlEvents:UIControlEventEditingDidEndOnExit];
}
[self _dismissKeyboard:button];
}
}
Expand Down Expand Up @@ -408,11 +413,6 @@ - (void)_dismissKeyboard:(id)sender
{
id <UIKeyInput> keyInput = self.keyInput;

if ([keyInput isKindOfClass:[UITextField class]]) {
UITextField * textField = (UITextField *)keyInput;
[textField sendActionsForControlEvents:UIControlEventEditingDidEndOnExit];
}

if ([keyInput isKindOfClass:[UIResponder class]]) {
[(UIResponder *)keyInput resignFirstResponder];
}
Expand Down Expand Up @@ -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];
}

Expand Down
2 changes: 1 addition & 1 deletion MMNumberKeyboard.podspec
Original file line number Diff line number Diff line change
@@ -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' }
Expand Down

0 comments on commit 4468bd4

Please sign in to comment.