detect use of floating digital keyboard

iOS 13 introduced the floating digitial keyboard and this breaks my custom inputView that I am using on a UITextField. Is there anyway to detect that the floating digital keyboard is being used so I can properly size / hide some buttons from my custom inputView?


I tried using size classes to hide things, however the width is considered regular instead of compact when the floating keyboard is used.

Replies

If you get keyboard size, is that OK ?


See how here on notification of keyboard show:

https://stackoverflow.com/questions/25451001/getting-keyboard-size-from-userinfo-in-swift


if let userInfo = notification.userInfo {
  if let keyboardSize = (userInfo[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.CGRectValue() {
     let contentInsets = UIEdgeInsets(top: 0, left: 0, bottom: keyboardSize.height, right: 0)
  // ...
  } else {
  // no UIKeyboardFrameBeginUserInfoKey entry in userInfo
  }
} else {
  // no userInfo dictionary in notification
}


May also read this:


https://stackoverflow.com/questions/7842806/check-for-split-keyboard