How can we know if iPad is using bluetooth keyboard or device virtual keyboard?

This question already has an answer here:

  • How can I detect if an external keyboard is present on an iPad? 11 answers

  • An indirect and SDK-safe way is to make a text field a first responder. If the external keyboard is present, the UIKeyboardWillShowNotification local notification shall not be posted.

    You can listen to the "GSEventHardwareKeyboardAttached"(kGSEventHardwareKeyboardAvailabilityChangedNotification) Darwin notification, but this is a private API, so it's possible your app will get rejected if you use this. To check if the external hardware is present, use the private GSEventIsHardwareKeyboardAttached() function.

    UIKit listens to this and sets the UIKeyboardImpl.isInHardwareKeyboardMode property accordingly, but again this is private API.

    I got this answer from here.

    链接地址: http://www.djcxy.com/p/58312.html

    上一篇: 将android蓝牙服务器绑定到套接字

    下一篇: 我们如何知道iPad是否使用蓝牙键盘或设备虚拟键盘?