4

Given an iPad app, when entering text I sometimes need to move the view up/down when the virtual keyboard is shown/hidden. Do do the move I use

-(void)keyboardDidShow:(NSNotification *)notification

and

-(void)keyboardDidHide:(NSNotification *)notification

Some customers have external bluetooth keyboards where the virtual keyboard doesn't appear when selecting a textfield/textview. Are these two methods ignored in those instances ? (I can't test it, since I don't have such hardware and I want to avoid moving the view up/down in case that it shouldn't.)

ty

matrix4use
  • 611
  • 1
  • 6
  • 20

2 Answers2

2

No, none of the keyboard notifications are sent if no virtual keyboard is presented or hidden. You can test this in the iPad Simulator using the "Hardware | Simulate Hardware Keyboard" toggle menu.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
  • One exception is described in this SO question: http://stackoverflow.com/questions/27830857/hide-inputaccessoryview-if-hardware-keyboard-is-connected -- if the keyboard has an inputAccessoryView, the keyboardDidShow notification will fire even if a hardware keyboard is connected. – arlomedia Feb 05 '15 at 20:11
0

Just to be safe, you might want to use the UIKeyboardDidShow notification instead of the one you are using. Then the context UIKeyboard would say that it only applies to the onscreen keyboard.

Andrew
  • 15,357
  • 6
  • 66
  • 101