MLKitBarcodeScanning 框架参考

MLKBarcode


@interface MLKBarcode : NSObject

图片中的条形码。

  • 包含已发现条形码的矩形(相对于视图中检测到的图片) 坐标系

    声明

    Objective-C

    @property (nonatomic, readonly) CGRect frame;
  • 条形码中编码的条形码值。结构化值不会被解析,例如: ‘MEBKM:TITLE:Google;URL:https://www.google.com;;’.不包括补充值。

    仅当条形码以 UTF-8 格式编码时,此功能才适用 条形码则使用 rawData

    声明

    Objective-C

    @property (nonatomic, readonly, nullable) NSString *rawValue;
  • 原始数据存储在条形码中。

    声明

    Objective-C

    @property (nonatomic, readonly, nullable) NSData *rawData;
  • 采用方便用户使用的格式的条形码值。可以省略在 条形码。例如,在上述情况中,显示值可能是“https://www.google.com”。 如果为 valueType == .text,则此字段将等于 rawValue。此值可以为多行, 例如,当换行符编码为原始 TEXT 条形码值时。可能包含 补充价值。

    声明

    Objective-C

    @property (nonatomic, readonly, nullable) NSString *displayValue;
  • 条形码格式;例如 EAN_13。请注意,如果格式未列出,则 .unknown 返回的值。

    声明

    Objective-C

    @property (nonatomic, readonly) MLKBarcodeFormat format;
  • 条形码的四个角点(按顺时针顺序,从左上角开始,相对于 在视图坐标系中检测到的图像。它们是封装在 NSValues 中的 CGPoints。到期日 则这不一定是矩形。

    声明

    Objective-C

    @property (nonatomic, readonly, nullable) NSArray<NSValue *> *cornerPoints;
  • 条形码值的类型。例如,TEXT、PRODUCT、网址 等。请注意,如果类型不是 则返回 .unknown

    声明

    Objective-C

    @property (nonatomic, readonly) MLKBarcodeValueType valueType;
  • 来自 MAILTO: 或类似二维码类型的电子邮件。只有当 valueType.email

    声明

    Objective-C

    @property (nonatomic, readonly, nullable) MLKBarcodeEmail *email;
  • “TEL:”或类似 QR 码类型的电话号码。仅当 valueType 满足以下条件时,才会设置此属性 .phone

    声明

    Objective-C

    @property (nonatomic, readonly, nullable) MLKBarcodePhone *phone;
  • sms

    “SMS:”或类似 QR 码类型的短信。仅当 valueType 时才设置此属性 为 .sms

    声明

    Objective-C

    @property (nonatomic, readonly, nullable) MLKBarcodeSMS *sms;
  • URL

    “MEBKM:”或类似 QR 码类型的网址和标题。仅当 valueType 时才设置此属性 为 .url

    声明

    Objective-C

    @property (nonatomic, readonly, nullable) MLKBarcodeURLBookmark *URL;
  • “WIFI:”或类似 QR 码类型的 Wi-Fi 网络参数。只有当 valueType.wifi

    声明

    Objective-C

    @property (nonatomic, readonly, nullable) MLKBarcodeWiFi *wifi;
  • GEO: 或类似 QR 码类型的 GPS 坐标。仅当 valueType 时才设置此属性 为 .geo

    声明

    Objective-C

    @property (nonatomic, readonly, nullable) MLKBarcodeGeoPoint *geoPoint;
  • 个人或组织的名片。例如 VCARD。只有当 valueType.contactInfo

    声明

    Objective-C

    @property (nonatomic, readonly, nullable) MLKBarcodeContactInfo *contactInfo;
  • 从二维码中提取的日历活动。仅当 valueType 满足以下条件时,才会设置此属性 .calendarEvent

    声明

    Objective-C

    @property (nonatomic, readonly, nullable) MLKBarcodeCalendarEvent *calendarEvent;
  • 驾照或身份证。仅当 valueType.driverLicense 时,才会设置此属性。

    声明

    Objective-C

    @property (nonatomic, readonly, nullable) MLKBarcodeDriverLicense *driverLicense;
  • 不可用。

    声明

    Objective-C

    - (nonnull instancetype)init;