在iOS中使用条形码扫描器作为键盘的方法?

时间:2021-01-23 21:51:20

I realize there are plenty of barcode scanning apps and bluetooth scanners, but I am wondering if the following exists for iOS. Let's say I'm completing a plain ol' form on a website. Normally when I tap on an input the keyboard will appear like this:

我知道有很多条码扫描应用程序和蓝牙扫描器,但我想知道iOS是否存在以下功能。假设我正在一个网站上填写一个简单的ol表格。通常,当我点击一个输入时,键盘会显示如下:

在iOS中使用条形码扫描器作为键盘的方法?

However, needing a barcode scanner, I thought it would be useful if you could tap the "change keyboard" button and have "Scanner" be one of the options listed along with English (US), Emoji, etc. This would pull up an interface something like the following:

但是,我认为如果你需要一个条码扫描器,如果你可以点击“改变键盘”按钮,让“扫描器”和英语(美国)、表情符号等选项一起列出来,那将会很有用。

在iOS中使用条形码扫描器作为键盘的方法?

Has anyone seen anything like this or know if it's possible create this functionality? Or is there a better implementation? Basically, I don't want another piece of hardware, and I want this scanner to be available to any app (such as a browser).

有人见过这样的东西吗?或者知道有可能创建这个功能吗?或者有更好的实现吗?基本上,我不想要另一个硬件,我想让这个扫描器对任何应用都可用(比如浏览器)。

3 个解决方案

#1


2  

I think the app ScanKey is providing the functionality you are looking for: https://itunes.apple.com/us/app/scankey-qr-barcode-keyboard/id1356206918

我认为应用程序ScanKey提供的功能是:https://itunes.apple.com/us/app/scankey-qr-barcode-keyboard/id1356206918

#2


1  

You cannot do this using the built-in change keyboard button. There is no public API for accessing that button.

不能使用内置的change键盘按钮来实现这一点。没有用于访问该按钮的公共API。

If you're really just displaying a web form in a UIWebView, there's really not much you can do at all using the public APIs, I think.

如果你只是在UIWebView中显示一个web表单,我认为你用公共api做什么都做不了。

If you build the form using views instead, you can get pretty close with some work. What you can do is use set the inputAccessoryView of your text fields to a toolbar that has a button for switching to/from the bar code reader. When the user turns on the bar code reader, set the text field's inputView to your bar code reader view. When the user turns off the bar code reader, set the inputView back to nil.

如果您使用视图来构建表单,您可以通过一些工作来获得非常接近的结果。您可以做的是将文本字段的inputAccessoryView设置为一个工具栏,该工具栏有一个按钮,用于切换条形码阅读器。当用户打开条形码阅读器时,将文本字段的inputView设置为条形码阅读器视图。当用户关闭条形码阅读器时,将inputView设置为nil。

You might be able to make that work for text fields in a UIWebView too, by digging around in the web view's private view hierarchy and whatnot, but you will definitely be relying on implementation details that can change in every release.

通过在web view的私有视图层次结构中挖掘,你可能也可以在UIWebView的文本字段中使用它,但是你肯定会依赖于实现细节,这些细节在每个版本中都会发生变化。

#3


-1  

Infinite peripherals has an add-on that provides a scanboard keyboard which has a key to scan barcode using webcam.

无限外围设备有一个附加组件,提供一个扫描键盘,有一个键扫描条码使用网络摄像头。

#1


2  

I think the app ScanKey is providing the functionality you are looking for: https://itunes.apple.com/us/app/scankey-qr-barcode-keyboard/id1356206918

我认为应用程序ScanKey提供的功能是:https://itunes.apple.com/us/app/scankey-qr-barcode-keyboard/id1356206918

#2


1  

You cannot do this using the built-in change keyboard button. There is no public API for accessing that button.

不能使用内置的change键盘按钮来实现这一点。没有用于访问该按钮的公共API。

If you're really just displaying a web form in a UIWebView, there's really not much you can do at all using the public APIs, I think.

如果你只是在UIWebView中显示一个web表单,我认为你用公共api做什么都做不了。

If you build the form using views instead, you can get pretty close with some work. What you can do is use set the inputAccessoryView of your text fields to a toolbar that has a button for switching to/from the bar code reader. When the user turns on the bar code reader, set the text field's inputView to your bar code reader view. When the user turns off the bar code reader, set the inputView back to nil.

如果您使用视图来构建表单,您可以通过一些工作来获得非常接近的结果。您可以做的是将文本字段的inputAccessoryView设置为一个工具栏,该工具栏有一个按钮,用于切换条形码阅读器。当用户打开条形码阅读器时,将文本字段的inputView设置为条形码阅读器视图。当用户关闭条形码阅读器时,将inputView设置为nil。

You might be able to make that work for text fields in a UIWebView too, by digging around in the web view's private view hierarchy and whatnot, but you will definitely be relying on implementation details that can change in every release.

通过在web view的私有视图层次结构中挖掘,你可能也可以在UIWebView的文本字段中使用它,但是你肯定会依赖于实现细节,这些细节在每个版本中都会发生变化。

#3


-1  

Infinite peripherals has an add-on that provides a scanboard keyboard which has a key to scan barcode using webcam.

无限外围设备有一个附加组件,提供一个扫描键盘,有一个键扫描条码使用网络摄像头。