Created
September 1, 2015 07:35
-
-
Save YGeorge/3ea92c7c0becdb9e375d to your computer and use it in GitHub Desktop.
Correct keyboard frame
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)keyboardWillShow:(NSNotification *)notification { | |
CGRect keyboardFrame = [[notification userInfo][UIKeyboardFrameEndUserInfoKey] CGRectValue]; | |
self.textViewBottomConstraint.constant = keyboardFrame.size.height - self.tabBarController.tabBar.frame.size.height; | |
UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTap:)]; | |
[self.view addGestureRecognizer:singleTap]; | |
[UIView animateWithDuration:[notification.userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue] | |
delay:0 | |
options:(UIViewAnimationOptions) [[notification userInfo][UIKeyboardAnimationCurveUserInfoKey] integerValue] | |
animations:^{ | |
[self.view layoutIfNeeded]; | |
[self scrollTableToBottom:NO]; | |
} completion:nil]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment