Skip to content

Instantly share code, notes, and snippets.

@YGeorge
Created September 1, 2015 07:35
Show Gist options
  • Save YGeorge/3ea92c7c0becdb9e375d to your computer and use it in GitHub Desktop.
Save YGeorge/3ea92c7c0becdb9e375d to your computer and use it in GitHub Desktop.
Correct keyboard frame
- (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