zxing连续扫描 - iphone [英] zxing continuous scanning - iphone

查看:152
本文介绍了zxing连续扫描 - iphone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将zxing库集成到我的应用程序中,但我的部分要求是能够连续扫描QR码。
我通过解雇和重新呈现zxing小部件已经在一定程度上实现了这一点,但对我的客户来说似乎太慢了。
还有另一种方法可以重置小部件以重新开始扫描吗?

I've integrated the zxing library into my app but part of my requirement is to be able to continually scan QR codes. I've accomplished this to a certain degree by dismissing and re-presenting the zxing widget but it appears to be too slow for my client. Is there another way to reset the widget to start scanning again?

推荐答案

你将不得不篡改ZXing图书馆,幸运的是,这并不难。

You will have to tamper with the ZXing library, fortunately it's not hard.

将以下方法添加到ZXingWidgetController

Add the following method to the ZXingWidgetController

在ZXingWidgetController.h中

In ZXingWidgetController.h

- (void)reset;

在ZXingWidgetController.m中

In ZXingWidgetController.m

- (void)reset
{
    decoding = YES;
    [overlayView setPoints:nil];
    wasCancelled = NO;
}

现在,在您的ZXing委托中,编辑以下方法

Now, in your ZXing delegate, edit the following method

- (void)zxingController:(ZXingWidgetController*)controller didScanResult:(NSString *)result
{
    //Handle your result as you want to

    [controller reset];
}

确保你没有打电话给 [self dismissModalViewControllerAnimated :NO]; 因为它将删除扫描视图。

Make sure you don't call [self dismissModalViewControllerAnimated:NO]; as it will remove the scanning view.

这篇关于zxing连续扫描 - iphone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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