ALScanViewDelegate

The ScanView, through its delegate, also provides some useful info that you can hook into while the scan view is running. Set the ALScanView 's delegate in order to be notified of these events:

  • Swift

  • Objective-C

protocol ALScanViewDelegate {
    optional func scanView(_ scanView: ALScanView, updatedCutoutWithPluginID pluginID: String, frame: CGRect)
    optional func scanViewMotionExceededThreshold(_ scanView: ALScanView)
    optional func scanView(_ scanView: ALScanView, didReceiveNativeBarcodeResult scanResult: ALScanResult)
}
@protocol ALScanViewDelegate <NSObject>
@optional
- (void)scanViewMotionExceededThreshold:(ALScanView *)scanView;
- (void)scanView:(ALScanView *)scanView didReceiveNativeBarcodeResult:(ALScanResult *)scanResult;
- (void)scanView:(ALScanView *)scanView updatedCutoutWithPluginID:(NSString *)pluginID frame:(CGRect)frame;
@end

The following methods can be implemented to enhance your scanning experience:

  • scanViewMotionExceededThreshold: tells you when excessive motion has been detected while the scan view is displayed. You can use this to prompt the user to steady their hold on the mobile device while scanning.

  • scanView:updatedCutoutWithPluginID:frame: can be used to determine where the cutouts in the scan view are, and to respond accordingly (for instance, you may use this to add and position info overlays telling the users what they should be scanning with the cutouts).

  • scanView:didReceiveNativeBarcodeResult: can return any barcodes found on the scan view while it is running.

scanView:didReceiveNativeBarcodeResult: uses barcode scanning native to the iOS system. It is different from the Anyline barcode scan plugin, which we provide a full plugin experience, and in which a variety of barcode symbologies are supported. Results may vary: for instance, only a small subset of symbologies are recognized by the native barcode scanner.