From f64a39cf3d938939d694269f69765a7376a8b2a5 Mon Sep 17 00:00:00 2001 From: Rob Enriquez Date: Fri, 10 Jun 2016 00:24:31 -0700 Subject: [PATCH] added cancel block --- QRCodeReaderViewController/QRCodeReaderViewController.h | 1 + QRCodeReaderViewController/QRCodeReaderViewController.m | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/QRCodeReaderViewController/QRCodeReaderViewController.h b/QRCodeReaderViewController/QRCodeReaderViewController.h index 619e502..e1fcf3a 100644 --- a/QRCodeReaderViewController/QRCodeReaderViewController.h +++ b/QRCodeReaderViewController/QRCodeReaderViewController.h @@ -215,5 +215,6 @@ * @since 3.0.0 */ @property (strong, nonatomic, readonly) QRCodeReader * __nonnull codeReader; +@property (copy, nonatomic)void(^CancelBlock)(void); @end diff --git a/QRCodeReaderViewController/QRCodeReaderViewController.m b/QRCodeReaderViewController/QRCodeReaderViewController.m index 0ca0205..79b741b 100644 --- a/QRCodeReaderViewController/QRCodeReaderViewController.m +++ b/QRCodeReaderViewController/QRCodeReaderViewController.m @@ -292,6 +292,10 @@ - (void)cancelAction:(UIButton *)button { [_codeReader stopScanning]; + if (self.CancelBlock) { + self.CancelBlock(); + } + if (_completionBlock) { _completionBlock(nil); }