zxing continuous scanning - iphone

我们两清 提交于 2019-12-21 02:41:37

问题


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?


回答1:


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

Add the following method to the ZXingWidgetController

In ZXingWidgetController.h

- (void)reset;

In ZXingWidgetController.m

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

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];
}

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




回答2:


Why not try for another great library ZBar - http://zbar.sourceforge.net/
Its quite easy and always work for me! You must have a look into if you are scanning QR codes in your app.



来源:https://stackoverflow.com/questions/6448501/zxing-continuous-scanning-iphone

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!