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