开发者

zxing continuous scanning - iphone

开发者 https://www.devze.com 2023-03-14 16:06 出处:网络
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 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 开发者_如何学JAVAbe too slow for my client. Is there another way to reset the widget to start scanning again?


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号