开发者

How can I detect when iOS 4 keyboard is on-screen versus Bluetooth?

开发者 https://www.devze.com 2023-03-18 07:26 出处:网络
I have some code that moves a UITextView out from under the on-screen开发者_如何学C keyboard. The problem is, sometimes people will surely use a Bluetooth keyboard instead.

I have some code that moves a UITextView out from under the on-screen开发者_如何学C keyboard. The problem is, sometimes people will surely use a Bluetooth keyboard instead.

How can I detect that that is what's being used for input?

Also, BTW: I can detect when the on-screen keyboard goes away, but how to approach the same intention when it's a wireless keyboard?

Thanks.


You can detect when a bluetooth keyboard is connected by registering for UIKeyboardWillShowNotification the same way that you did for detecting when the keyboard hides. If a BT keyboard is connected, you will not receive a keyboard will show notification when the text field or text view that is requesting the keyboard becomes the first responder.

0

精彩评论

暂无评论...
验证码 换一张
取 消