diff --git a/UIViewController+KeyboardAnimation.m b/UIViewController+KeyboardAnimation.m index 18d5c53..0f4c089 100644 --- a/UIViewController+KeyboardAnimation.m +++ b/UIViewController+KeyboardAnimation.m @@ -34,6 +34,15 @@ @implementation UIViewController (KeyboardAnimation) - (void)an_subscribeKeyboardWithAnimations:(ANAnimationsWithKeyboardBlock)animations completion:(ANCompletionKeyboardAnimations)completion { [self an_subscribeKeyboardWithBeforeAnimations:nil animations:animations completion:completion]; + //tap guesture and swipe down guesture to close view + [self.view addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hideKeyboard)]]; + UISwipeGestureRecognizer *swipeDown = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(hideKeyboard)]; + [swipeDown setDirection:UISwipeGestureRecognizerDirectionDown]; + [self.view addGestureRecognizer:swipeDown]; +} + +- (void) hideKeyboard{ + [self.view endEditing:true]; } - (void)an_subscribeKeyboardWithBeforeAnimations:(ANBeforeAnimationsWithKeyboardBlock)beforeAnimations