I have found that UIKeyboardWillShowNotification
and UIKeyboardDidShowNotification
are not generated when an undocked/split keyboard appears in iOS 5
. For instance, tap into a text field to show the keyboard (notifications are generated), undock the keyboard, tap out of the text field to dismiss the keyboard, tap on the text field again to show the undocked keyboard (notifications are not generated).
Is there any way to detect when the keyboard appears regardless of whether it is docked or not?
You need to observe UIKeyboardWillChangeFrameNotification
and UIKeyboardDidChangeFrameNotification
instead. When you get them, you can look at the value for UIKeyboardFrameEndUserInfoKey
(if it exists, it doesn't always while dragging the keyboard) and see if that rect intersects the window to see if the keyboard is now on or off screen.
If the keyboard appears undocked / split, you don't need to detect it. The whole point of the undocked / split keyboard is that the user can move it freely if it's in the way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With