Force on screen keyboard to show when bluetooth keyboard connected(连接蓝牙键盘时强制屏幕键盘显示)
问题描述
我必须将蓝牙扫描仪连接到我正在开发的应用程序.扫描仪充当键盘输入,但没有键,只有一个按钮用于扫描.我遇到的问题是用户需要在屏幕上与一些 UITextField 进行交互.
I have to have a bluetooth scanner connected to an app I am developing. The scanner acts as a keyboard input but there are no keys, only a button to scan with. The problem I am running into is there are a few UITextFields that a user needs to interact with on the screen.
当用户点击文本框输入数据时,没有键盘弹出,因为 iOS 认为有一个通过蓝牙连接的全键盘.
When the user taps the textfield to enter in data, no keyboard pops up because the iOS thinks there is a full keyboard attached via bluetooth.
如何在 UITextField 成为第一响应者"时强制显示屏幕键盘?
How can I force the screen keyboard to show up when the UITextField "becomes first responder" ?
提前致谢!
推荐答案
问题是蓝牙扫描仪冒充蓝牙键盘,所以iOS认为不需要在屏幕上显示.
The problem is that the Bluetooth scanner is pretending to be a Bluetooth keyboard, so iOS thinks that it doesn't need to show the onscreen one.
不幸的是,这个问题没有简单的答案.一些扫描仪有一个按钮,您可以按下它来强制屏幕键盘出现.有些允许您在iPhone 模式"(或类似模式)下配对,这样它就不会充当蓝牙键盘.
Unfortunately there's no easy answer for this. Some scanners have a button you can press that will force the onscreen keyboard to come up. Some allow you to pair in "iPhone mode" (or something similar) so that it doesn't act as a Bluetooth keyboard.
这个对相关问题的回答(https://stackoverflow.com/a/3837131/493988)有什么似乎是基于 UITextField 的 inputAccessoryView 的 hack,但我没有亲自验证它,所以我不能说太多.祝你好运!
This answer to a related question (https://stackoverflow.com/a/3837131/493988) has what seems like a hack based on a UITextField's inputAccessoryView, but I haven't personally verified it so I can't say much about it. Good luck!
这篇关于连接蓝牙键盘时强制屏幕键盘显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:连接蓝牙键盘时强制屏幕键盘显示


基础教程推荐
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01