My application need to know are external keyboard connect or no. How could i do to know that? No Private API please. :)
Asked
Active
Viewed 3,346 times
5
-
Is it mac os x or ios related? please retag you question. – Eimantas Mar 16 '11 at 10:26
-
Possible duplicate of [How to reliably detect if an external keyboard is connected on iOS 9?](https://stackoverflow.com/questions/31991873/how-to-reliably-detect-if-an-external-keyboard-is-connected-on-ios-9) – Victor Sergienko Oct 09 '17 at 19:16
1 Answers
0
If this is iOS related, I'm not sure why you'd want to detect this as the hardware keyboard acts exactly the same as the software keyboard (except with a few extra shortcuts for sound, brightness etc. which your app shouldn't use anyway).
If you're considering screen space, then the software keyboard will still send it's notifications when it is displayed or when it is hidden, so you can respond to those. For example, say you have the software keyboard up and then you connect your external keyboard. The software keyboard will hide, and will post the UIKeyboardWillHideNotification. So you can respond to that.

James Bedford
- 28,702
- 8
- 57
- 64
-
1I don't know if in your application you can detect use UIKeyBoardWillHideNotification because in my application when I connect the external keyboard the application can call UIKeyboardWillShowNotification but can't call the UIKeyboardWillHideNotification. But thank's for your response James. :) – Rizki Mar 24 '11 at 03:13
-
5One reason you want to detect this is if you are using InputAccessoryView and don't want that to show if the onscreen keyboard is not being shown. – Robert Kozak May 03 '11 at 00:58