Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 252
titaniumdecoy Avatar asked Oct 17 '11 20:10

titaniumdecoy


2 Answers

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.

like image 60
smparkes Avatar answered Nov 10 '22 01:11

smparkes


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.

like image 21
matt Avatar answered Nov 10 '22 01:11

matt