文档管理中心

HmsCustomScanViewController

定义全局hmsCustomScanViewController。扫码工具类,用于检测权限并启动扫码界面,提供Customized View扫码方式。

Declaration

收起
自动换行
深色代码主题
复制
  1. @interface HmsCustomScanViewController : UIViewController

在调用方法中进行初始化,需要初始化DefaultScanView的代理方法:

收起
自动换行
深色代码主题
复制
  1. HmsCustomScanViewController *hmsCustomScanViewController;
  2. hmsDefaultScanViewController.defaultScanDelegate = self;
  3. 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)。

backAction

页面返回需要调用的方法。

Declaration

收起
自动换行
深色代码主题
复制
  1. -(void)backAction

customizedScanDelegateForResult

扫码返回结果数据的代理方法。

Declaration

收起
自动换行
深色代码主题
复制
  1. -(void)customizedScanDelegateForResult:(NSDictionary *)resultDic

Returns

展开

Type

Description

NSDictionary

扫码方式中扫码结果的回调NSDictionary数据,包含以下内容:

  • zoomValue:相机镜头放大系数。
  • text:码返回值。
  • exposureAdjustmentValue:曝光系数。
  • formatValue:码制式。
  • ResultPoint:码图角点坐标位置。
  • sceneType:场景类型。
  • parserDic:对应场景返回的值。其中包含有:
    • Contact(联系人信息)
    • Email(邮箱)
    • WebSite(URL链接)
    • ISBN
    • Location(地理位置信息)
    • SMS(SMS短信信息)
    • Tel(电话)
    • EVENT(日历事件信息)
    • Wi-Fi(Wi-Fi信息)

initCustomizedScanWithFormatType

设置扫码制式选项。

Declaration

收起
自动换行
深色代码主题
复制
  1. -(instancetype)initCustomizedScanWithFormatType:(HmsScanOptions *)scanOptions

设置options参数并初始化ScanViewController:

收起
自动换行
深色代码主题
复制
  1. HmsScanOptions *options = [[HmsScanOptions alloc] initWithScanFormatType:ALL Photo:FALSE];
  2. self.hmsCustomScanViewController = [[HmsCustomScanViewController alloc] initCustomizedScanWithFormatType:options];
Parameters
展开

Name

Description

Photo

代表相机扫码或图片扫码,此处传入FALSE为相机扫码。

ScanFormatType

ALL是枚举类型参数,可以用位运算符连接多种码制,如:QR_CODE | AZTEC。

pauseContinuouslyScan

暂停连续扫码。

Declaration

收起
自动换行
深色代码主题
复制
  1. -(void)pauseContinuouslyScan

resumeContinuouslyScan

恢复连续扫码。

Declaration

收起
自动换行
深色代码主题
复制
  1. -(void)resumeContinuouslyScan
在 API参考 中进行搜索
请输入您想要搜索的关键词