连接蓝牙输入设备时显示软键盘(iPad) [英] display soft keyboard (iPad) when is connected a bluetooth input device
问题描述
我真的很头疼,因为当有蓝牙输入设备连接到 iPad 时,我找不到显示软键盘的方法.我在网上搜索了一下,结果如下:
I'm really bangin' my head because I can't find the way to show the soft keyboard when there's a bluetooth input device connected to the iPad. I made some search on the web and this is the result:
- 一个关于 stackoverflow 的问题,答案很短 我如何检测iPad 上有外接键盘吗?
- 由 erica sadun 为 cydia env 开发的应用程序 http://www.tuaw.com/2010/06/02/hacksugar-bringing-back-the-on-screen-keyboard/
Erica 说诀窍是回答系统没有连接硬件键盘".我试图为 UIKeyboardImpl 编写一个类别,但我覆盖了:
Erica said that the trick is to answer to the system that "There's no hardware keyboard attached". I tried to write a category for UIKeyboardImpl and I overrided:
- (BOOL)isInHardwareKeyboardMode {
DEBUG(@"is called");
return NO;
}
但直到现在我还没有得到任何东西.调用了被覆盖的方法,但没有软键盘.Erica 还说该应用程序通过动态链接工作,但我不知道如何实现它.我不需要在 AppStore 中,因为这是一个私人应用程序,所以我不用担心被拒绝.
But until now I haven't obtained anything. The overrided method is called but there's no soft keyboard. Erica also said the application works by dynamic linking but I don't know how can I accomplish it. I don't need to be in the AppStore because this is a private application so I don't bother about rejection.
提前致谢
推荐答案
好的.终于得到了.非常感谢大卫、马蒂亚斯和恩里科.以下是步骤:
Ok. Finally got it. Many thanks to David, Matthias and Enrico. Here are the steps:
- 导入私有框架 GraphicsServices
- 在 viewDidLoad 中调用 GSEventSetHardwareKeyboardAttached(NO)
添加一个按钮,通过调用来切换键盘
- import the private framework GraphicsServices
- call GSEventSetHardwareKeyboardAttached(NO) inside the viewDidLoad
add a button that toggles the keyboard by calling
static void toggleKeyboard(UIKeyboardImpl * keyImpl){
if (UIKeyboardAutomaticIsOnScreen()) {
UIKeyboardOrderOutAutomatic();
} else {
UIKeyboardOrderInAutomatic();
}
我在 http://code.google.com/p 上找到了这个功能/btstack/wiki/iPhoneKeyboardHiding现在我可以同时从软键盘和蓝牙设备接收输入.
I've found this function on http://code.google.com/p/btstack/wiki/iPhoneKeyboardHiding Now I can take input from the soft keyboard and from the bluetooth device at the same time.
这篇关于连接蓝牙输入设备时显示软键盘(iPad)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!