How to know the height of the cell above the keyboard? This is the line that displays corrections, predictive set, etc.

enter image description here

1 answer 1

As far as I understand, you need the full keyboard height. You can get it by subscribing to the UIKeyboardWillShowNotification notification:

 [[NSNotificationCenter defaultCenter] addObserverForName:UIKeyboardWillShowNotification object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) { CGFloat height = [note.userInfo[UIKeyboardFrameBeginUserInfoKey] CGRectValue].size.height; // меняем констрейнты с учетом высоты клавиатуры }]; 

The height of the accessoryView can be calculated by removing the height of the standard keyboard from the value obtained (216 for the portrait and 162 for the landscape).

  • The fact of the matter is that I need to understand if there is an accessoryView, and if there is, then find out its height, because in one view the usual keyboard and uipickerview is used, and they are of different heights. When you switch between different TextField, the interface jumps to the difference in keyboard heights. - Mikhail Sh.
  • Then just subtract the height of the standard keyboard from the resulting height (added values ​​in response) - Igor
  • Thank. It worked. - Mikhail Sh.