MBRecognizerRunnerViewController
@protocol MBRecognizerRunnerViewController <NSObject>
Protocol for View controllers which present camera and provide scanning features
-
MBRecognizerRunnerViewController’s shouldAutorotate will return this value.
Default: NO.
Set it to YES if you want scanning view controller to autorotate.
Declaration
Objective-C
@property (assign, readwrite, nonatomic) BOOL autorotate;
Swift
var autorotate: Bool { get set }
-
MBRecognizerRunnerViewController’s supportedInterfaceOrientations will return this value.
Default: UIInterfaceOrientationMaskPortrait.
Declaration
Objective-C
@property (assign, readwrite, nonatomic) UIInterfaceOrientationMask supportedOrientations;
Swift
var supportedOrientations: UIInterfaceOrientationMask { get set }
-
Pause scanning without dismissing the camera view.
If there is camera frame being processed at a time, the processing will finish, but the results of processing will not be returned.
Warning
must be called from Main thread to ensure thread synchronizationDeclaration
Objective-C
- (BOOL)pauseScanning;
Swift
func pauseScanning() -> Bool
-
Retrieve the current state of scanning.
Warning
must be called from Main thread to ensure thread synchronization
Declaration
Objective-C
- (BOOL)isScanningPaused;
Swift
func isScanningPaused() -> Bool
Return Value
YES if scanning is paused. NO if it’s in progress
-
Resumes scanning. Optionally, internal state of recognizers can be reset in the process.
If you continue scanning the same object, for example, the same slip, or the same MRTD document, to get result with higher confidence, then pass NO to reset State.
If you move to scan another object, for example, another barcode, or another payment slip, then pass YES to reset State.
Internal state is used to use the fact that the same object exists on multiple consecutive frames, and using internal state provides better scanning results.
Warning
must be called from Main thread to ensure thread synchronization
Declaration
Objective-C
- (BOOL)resumeScanningAndResetState:(BOOL)resetState;
Swift
func resumeScanningAndResetState(_ resetState: Bool) -> Bool
Parameters
resetState
YES if state should be reset.
-
Resumes camera session. This method is automatically called in viewWillAppear when ScanningViewController enters screen.
Declaration
Objective-C
- (BOOL)resumeCamera;
Swift
func resumeCamera() -> Bool
-
Pauses camera session. This method is automatically called in viewDidDissapear when ScanningViewController exits screen.
Declaration
Objective-C
- (BOOL)pauseCamera;
Swift
func pauseCamera() -> Bool
-
Retrieve the current state of camera.
Declaration
Objective-C
- (BOOL)isCameraPaused;
Swift
func isCameraPaused() -> Bool
Return Value
YES if camera is paused. NO if camera is active
-
Play scan sound.
It uses default scan sound, you can change it by setting your own soundFilePath in MBOverlaySettings.
Declaration
Objective-C
- (void)playScanSuccessSound;
Swift
func playScanSuccessSound()
-
Call to turn on torch without camera overlay
Declaration
Objective-C
- (void)willSetTorchOn:(BOOL)torchOn;
Swift
func willSetTorch(on torchOn: Bool)
-
Declaration
Objective-C
- (void)resetState;
Swift
func resetState()
-
Method with block for getting high resoultion images
Warning
this is returned from background threadDeclaration
Objective-C
- (void)captureHighResImage: (nonnull MBCaptureHighResImage)highResoulutionImageCaptured;
Swift
func captureHighResImage(_ highResoulutionImageCaptured: @escaping MBCaptureHighResImage)