2

I'm using the new simulator with iOS7 and iOS8. Cmd-K toggles the software keyboard - to simulate hardware keyboards. What's the best way to detect whether the software keyboard is displayed?

I'm observing UIKeyboardWillShowNotification but it's returning the height of the software keyboard (in my case 266) even though the software keyboard isn't displayed.

NSValue* keyboardFrameBegin = [keyboardInfo valueForKey:UIKeyboardFrameEndUserInfoKey];

Is there a way to determine whether the software keyboard is displayed?

Thanks for the help!

Ender2050
  • 6,912
  • 12
  • 51
  • 55

2 Answers2

0

I think what you are looking for is the keyboardDidShow Notification instead:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidShow) name:UIKeyboardDidShowNotification object:nil];
archipestre
  • 182
  • 9
  • You're right, I should be using didShow. But iOS8 is still giving me the full height of the keyboard (266) even though it isn't displayed. Agh. – Ender2050 Oct 03 '14 at 02:27
-1

Observe UIKeyboardWillShowNotification. You can get the keyboard height from the notification object.

pickwick
  • 3,134
  • 22
  • 30
  • Thanks, but I'm getting the height of the software keyboard (266) even though it's not displayed. Is there another value? – Ender2050 Oct 03 '14 at 01:42