Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

zxing continuous scanning - iphone

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?

like image 242
noahd Avatar asked Dec 12 '22 12:12

noahd


1 Answers

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.

like image 112
Radu Lucaciu Avatar answered Dec 25 '22 12:12

Radu Lucaciu