0

I've got this code to shrink and move my controls when the keyboard opens:

-(void)keyboardWillShow:(NSNotification *)notification {
    NSValue *value = [notification.userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey];
    NSTimeInterval interval = 0;
    [value getValue:&interval];

    CGSize keyboardSize = [[notification.userInfo objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;

    [UIView animateWithDuration:interval animations:^{
        self.composeBarBottomConstraint.constant = (-1) * keyboardSize.height;
        [self.view layoutIfNeeded];
    }];
}

This works perfect with the normal keyboard, but when I tap the emoji keyboard button the UI controls position isn't where it should be (offset upwards) and jumps rather than animating - making me think the values I retrieve from [notification userInfo] is wrong with the emoji keyboard.

Any ideas what's going on here?

Erik
  • 2,500
  • 6
  • 28
  • 49

1 Answers1

0

Replace UIKeyboardFrameBeginUserInfoKey to UIKeyboardFrameEndUserInfoKey. This key contains the information about keyboard size after all animations that system will perform. You can read more in this answer

Community
  • 1
  • 1
Azat
  • 6,745
  • 5
  • 31
  • 48