1

all.

I'm trying to catch the keyboard split event on iPad, iOS5. I've registered method for all keyboard notifications and that's what notification I get when I split the keyboard (in the order of appearance):

UIKeyboardWillHideNotification UIKeyboardWillChangeFrameNotification UIKeyboardDidHideNotification UIKeyboardDidChangeFrameNotification UIKeyboardDidChangeFrameNotification

So, no WillShow or DidShow notification, but the keyboard is still on the screen.

The two consequent UIKeyboardDidChangeFrameNotification would have helped (I could have contained positions of the both parts of the keyboard), but, alas, UIKeyboardFrameEndUserInfoKey key contains the same value (origin (352; 0), size (316; 1024)) for both notifications.

So the question is: how to catch the split keyboard event in iPad, iOS5?

dimayak
  • 143
  • 1
  • 8

1 Answers1

4

When the keyboard is docked, UIKeyboardWillShowNotification will be raised. If the keyboard is split or undocked, no keyboard notifications are raised.

If a keyboard is docked, UIKeyboardWillShowNotification will be raised, and the following will be true:

[[[notification userInfo] valueForKey:@"UIKeyboardFrameChangedByUserInteraction"] intValue] == 1

If a keyboard is undocked, UIKeyboardWillHideNotification will be raised, and the above statement will also be true.

Using this information has been adequate for me to code my user interface.

Note: this might be a violation of Apple's guidelines, I'm not sure.

David Lawson
  • 7,802
  • 4
  • 31
  • 37
  • It's not a violation, because it's no private API. Apple uses it in its own apps, e.g. for the split keyboard overlay in Numbers. – manmal Nov 26 '12 at 16:34