titaniumdecoy
titaniumdecoy

Reputation: 19251

UIKeyboardWillShowNotification not called for an undocked keyboard in iOS 5

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?

Upvotes: 13

Views: 6538

Answers (2)

matt
matt

Reputation: 535306

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.

Upvotes: 4

smparkes
smparkes

Reputation: 14063

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.

Upvotes: 10

Related Questions