Skip to content

Commit a2a8cc2

Browse files
committed
Merge pull request #12 from hswolff/feature/hide-keyboard
Add new public method: hideKeyboard
2 parents 50be057 + 2a008c8 commit a2a8cc2

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

DAKeyboardControl/DAKeyboardControl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,6 @@ typedef void (^DAKeyboardDidMoveBlock)(CGRect keyboardFrameInView);
2121

2222
- (CGRect)keyboardFrameInView;
2323

24+
- (void)hideKeyboard;
25+
2426
@end

DAKeyboardControl/DAKeyboardControl.m

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,13 @@ - (void)removeKeyboardControl
154154
self.keyboardPanRecognizer = nil;
155155
}
156156

157+
- (void)hideKeyboard
158+
{
159+
self.keyboardActiveView.hidden = YES;
160+
self.keyboardActiveView.userInteractionEnabled = NO;
161+
[self.keyboardActiveInput resignFirstResponder];
162+
}
163+
157164
#pragma mark - Input Notifications
158165

159166
- (void)responderDidBecomeActive:(NSNotification *)notification
@@ -364,9 +371,7 @@ - (void)panGestureDidChange:(UIPanGestureRecognizer *)gesture
364371
completion:^(BOOL finished){
365372
if (!within44Pixels)
366373
{
367-
self.keyboardActiveView.hidden = YES;
368-
self.keyboardActiveView.userInteractionEnabled = NO;
369-
[self.keyboardActiveInput resignFirstResponder];
374+
[self hideKeyboard];
370375
}
371376
}];
372377
}
@@ -392,9 +397,7 @@ - (void)panGestureDidChange:(UIPanGestureRecognizer *)gesture
392397
completion:^(BOOL finished){
393398
if (!within44Pixels)
394399
{
395-
self.keyboardActiveView.hidden = YES;
396-
self.keyboardActiveView.userInteractionEnabled = NO;
397-
[self.keyboardActiveInput resignFirstResponder];
400+
[self hideKeyboard];
398401
}
399402
}];
400403
}

0 commit comments

Comments
 (0)