MLKBarcode
@interface MLKBarcode : NSObject
圖片中的條碼。
-
在檢視座標系統中,保留找到的條碼相對位置的矩形。
聲明
Objective-C
@property (nonatomic, readonly) CGRect frame;
-
條碼中的編碼值。系統不會剖析結構化值,例如:「MEBKM:TITLE:Google;URL:https://www.google.com;;」。不包括補充值。
只有在條碼是以 UTF-8 格式編碼時,才能使用該屬性,非 UTF8 條碼請改用
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;
-
條碼的四個角落點,按順時針順序,從左上方開始,相對於檢視座標系統中偵測到的圖片。這些
CGPoints
會納入NSValues
中。由於可能導致視角變形,因此這不一定是矩形。聲明
Objective-C
@property (nonatomic, readonly, nullable) NSArray<NSValue *> *cornerPoints;
-
條碼值的類型。例如 TEXT、PRODUCT、網址等。請注意,如果類型不在清單中,就會傳回
.unknown
。聲明
Objective-C
@property (nonatomic, readonly) MLKBarcodeValueType valueType;
-
來自
MAILTO:
或類似 QR code 類型的電子郵件。只有在valueType
為.email
時,才需要設定這個屬性。聲明
Objective-C
@property (nonatomic, readonly, nullable) MLKBarcodeEmail *email;
-
「TEL:」或類似 QR code 類型的電話號碼。只有在
valueType
為.phone
時,才能設定這個屬性。聲明
Objective-C
@property (nonatomic, readonly, nullable) MLKBarcodePhone *phone;
-
來自「簡訊:」或類似 QR code 類型的簡訊。只有在
valueType
為.sms
時,才需要設定這個屬性。聲明
Objective-C
@property (nonatomic, readonly, nullable) MLKBarcodeSMS *sms;
-
來自「MEBKM:」或類似 QR code 類型的網址和標題。只有在
valueType
為.url
時,才需要設定這個屬性。聲明
Objective-C
@property (nonatomic, readonly, nullable) MLKBarcodeURLBookmark *URL;
-
「WIFI:」或類似 QR code 類型的 Wi-Fi 網路參數。只有在
valueType
為.wifi
時,才需要設定這個屬性。聲明
Objective-C
@property (nonatomic, readonly, nullable) MLKBarcodeWiFi *wifi;
-
GEO:
或類似 QR code 類型的 GPS 座標。只有在valueType
為.geo
時,才需要設定這個屬性。聲明
Objective-C
@property (nonatomic, readonly, nullable) MLKBarcodeGeoPoint *geoPoint;
-
個人或機構的名片。例如 VCARD。只有在
valueType
為.contactInfo
時,才需要設定這個屬性。聲明
Objective-C
@property (nonatomic, readonly, nullable) MLKBarcodeContactInfo *contactInfo;
-
從 QR code 擷取的日曆活動。只有在
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;