zBar 相机中的闪光灯 [英] Flash in zBar Camera

查看:31
本文介绍了zBar 相机中的闪光灯的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 ZBAR 进行二维码扫描.我已经正确地实现了 ZBar.现在我想在 Zbar 中打开或关闭闪光灯.

I am using ZBAR for Qr code scanning. I had implemented ZBar correctly. Now I want to make flash light on or off in Zbar.

在 ZBar 网站上,我只得到关于 Torch 的信息,但没有关于手电筒的信息.

On ZBar website I only get information about Torch but no information about flash light.

推荐答案

闪光"是指灯闪烁"一瞬间.手电筒"是灯亮着的时候.您确实需要手电筒",而不是闪光灯".如果灯只闪烁一秒钟,将很难扫描条形码.

The "flash" is when the light "flashes" for a split second. The "torch" is when the light stays on. You do want "torch", not "flash". It would be hard to scan a barcode if the light only flashed for a split second.

我已经完成了你要找的工作.我在导航栏中添加了一个 UIBarButtonItem.我用自定义图像创建了按钮.按钮处理程序如下:

I've done what you are look for. I added a UIBarButtonItem to the navbar. I created the button with a custom image. The button handler is as follows:

- (void)torchToggle:(UIBarButtonItem *)button {
    if (button.style == UIBarButtonItemStyleBordered) {
        self.readerView.torchMode = AVCaptureTorchModeOff;
        if (self.readerView.torchMode == AVCaptureTorchModeOff) {
            button.style = UIBarButtonItemStyleDone;
        }
    } else {
        self.readerView.torchMode = AVCaptureTorchModeOn;
        if (self.readerView.torchMode != AVCaptureTorchModeOff) {
            button.style = UIBarButtonItemStyleBordered;
        }
    }
}

这篇关于zBar 相机中的闪光灯的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆