定义全局hmsCustomScanViewController。扫码工具类,用于检测权限并启动扫码界面,提供Customized View扫码方式。
Declaration
@interface HmsCustomScanViewController : UIViewController
在调用方法中进行初始化,需要初始化DefaultScanView的代理方法:
HmsCustomScanViewController *hmsCustomScanViewController; hmsDefaultScanViewController.defaultScanDelegate = self; hmsCustomScanViewController = [[HmsCustomScanViewController alloc] init];
Properties
Name | Description |
|---|---|
@property (nonatomic) BOOL backButtonHidden | 设置隐藏返回按钮。格式如:backButtonHidden = true。 |
@property (nonatomic) BOOL continuouslyScan | 设置是否持续扫码,默认为false。true为持续扫码。格式如:continuouslyScan = true。 |
@property (nonatomic) CGRect cutArea | 设置Customized View扫码区域。格式如:CGRectMake(50, 50, 450, 450)。 |
扫码返回结果数据的代理方法。
Declaration
-(void)customizedScanDelegateForResult:(NSDictionary *)resultDic
Returns
Type | Description |
|---|---|
NSDictionary | 扫码方式中扫码结果的回调NSDictionary数据,包含以下内容:
|
设置扫码制式选项。
Declaration
-(instancetype)initCustomizedScanWithFormatType:(HmsScanOptions *)scanOptions
设置options参数并初始化ScanViewController:
HmsScanOptions *options = [[HmsScanOptions alloc] initWithScanFormatType:ALL Photo:FALSE]; self.hmsCustomScanViewController = [[HmsCustomScanViewController alloc] initCustomizedScanWithFormatType:options];
Name | Description |
|---|---|
Photo | 代表相机扫码或图片扫码,此处传入FALSE为相机扫码。 |
ScanFormatType | ALL是枚举类型参数,可以用位运算符连接多种码制,如:QR_CODE | AZTEC。 |