Skip to content

Commit

Permalink
Start scanning once camera is ready
Browse files Browse the repository at this point in the history
  • Loading branch information
mrako committed May 1, 2019
1 parent 7edb825 commit c4a0e81
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion examples/BarcodeScanner/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ - (void)viewDidLoad {
self.capture.focusMode = AVCaptureFocusModeContinuousAutoFocus;
self.capture.delegate = self;

self.scanning = YES;
self.scanning = NO;

[self.view.layer addSublayer:self.capture.layer];

Expand Down Expand Up @@ -209,6 +209,10 @@ - (NSString *)barcodeFormatToString:(ZXBarcodeFormat)format {

#pragma mark - ZXCaptureDelegate Methods

- (void)captureCameraIsReady:(ZXCapture *)capture {
self.scanning = YES;
}

- (void)captureResult:(ZXCapture *)capture result:(ZXResult *)result {
if (!self.scanning) return;
if (!result) return;
Expand Down

0 comments on commit c4a0e81

Please sign in to comment.