目录

HmsCustomScanViewController

Defines the global instance constant hmsCustomScanViewController. This is a barcode scanning utility class, which is used to check permissions and start the barcode scanning screen. It supports barcode scanning in Customized View mode.

Declaration

@interface HmsCustomScanViewController : UIViewController

To perform initialization in a called method, initialize the delegate method of DefaultScanView:

HmsCustomScanViewController *hmsCustomScanViewController;
hmsDefaultScanViewController.defaultScanDelegate = self;
hmsCustomScanViewController = [[HmsCustomScanViewController alloc] init];

Properties

Name

Description

@property (nonatomic) BOOL backButtonHidden

Indicates whether to hide the back button. Example: backButtonHidden = true

@property (nonatomic) BOOL continuouslyScan

Indicates whether to perform continuous scanning. The default value is false. The value true indicates that continuous scanning is performed. Example: continuouslyScan = true

@property (nonatomic) CGRect cutArea

Sets an area for scanning in Customized View mode. Example: CGRectMake(50, 50, 450, 450)

backAction

Returns to the previous page.

Declaration

-(void)backAction

customizedScanDelegateForResult

Delegate method for returning scanning result data.

Declaration

-(void)customizedScanDelegateForResult:(NSDictionary *)resultDic

Returns

Type

Description

NSDictionary

NSDictionary class that contains scanning result data, including:

  • zoomValue: camera lens magnification ratio
  • text: barcode value
  • exposureAdjustmentValue: exposure coefficient
  • formatValue: barcode format
  • ResultPoint: coordinates of barcode corners
  • sceneType: scenario type
  • parserDic: data returned in the corresponding scenario, including:
    • Contact: contact information
    • Email: email address
    • WebSite: URL
    • ISBN
    • Location: location information
    • SMS: SMS information
    • Tel: phone number
    • EVENT: calendar event
    • Wi-Fi: Wi-Fi information

initCustomizedScanWithFormatType

Sets barcode format options.

Declaration

-(instancetype)initCustomizedScanWithFormatType:(HmsScanOptions *)scanOptions

Set the options parameter and initialize ScanViewController.

HmsScanOptions *options = [[HmsScanOptions alloc] initWithScanFormatType:ALL Photo:FALSE];
self.hmsCustomScanViewController = [[HmsCustomScanViewController alloc] initCustomizedScanWithFormatType:options];
Parameters

Name

Description

Photo

Specifies whether the camera mode or image mode is used. Value FALSE indicates the camera mode.

ScanFormatType

ALL is an enumeration-type parameter. You can use bitwise operators to concatenate different barcode formats, for example, QR_CODE | AZTEC.

pauseContinuouslyScan

Pauses continuous scanning.

Declaration

-(void)pauseContinuouslyScan

resumeContinuouslyScan

Resumes continuous scanning.

Declaration

-(void)resumeContinuouslyScan