AVCaptureMetadataOutput的metadataObjectTypes属性的常量吗? [英] Constants for AVCaptureMetadataOutput's metadataObjectTypes property?
问题描述
使用AVFoundation检测图像中的特征(例如人脸或条形码)时,您必须拨打以下行:
When using AVFoundation to detect features (e.g. faces or barcodes) in an image, you must call a line such as:
AVCaptureMetadataOutput *metadataOutput = ...;
metadataOutput.metadataObjectTypes = metadataOutput.availableMetadataObjectTypes;
检查availableMetadataObjectTypes显示以下字符串:
Examining availableMetadataObjectTypes shows the following strings:
face,
"org.gs1.UPC-E",
"org.iso.Code39",
"org.iso.Code39Mod43",
"org.gs1.EAN-13",
"org.gs1.EAN-8",
"com.intermec.Code93",
"org.iso.Code128",
"org.iso.PDF417",
"org.iso.QRCode",
"org.iso.Aztec"
如果我正在编写条形码扫描应用程序,那么我不希望框架查找人脸,因此,我不想传递metadataOutput.availableMetadataObjectTypes
,而是传递特定的条形码来查找.我希望不使用这些硬编码的字符串,而是希望将它们定义为某个地方的常量.
If I am writing a barcode scanning app, I don't want the framework to be looking for faces, so instead of passing metadataOutput.availableMetadataObjectTypes
, I want to pass specific barcodes to look for. Rather than using these hard-coded strings, I was hoping they were defined as constants somewhere.
它们是否存在于框架中的任何位置,还是必须使用硬编码的字符串?
Do they exist anywhere in the framework, or must I use hard-coded strings?
推荐答案
只有AVMetadataMachineReadableCodeObject
类(因此您可以执行以下操作:
So you can do something like this:
metadataOutput.metadataObjectType = @[AVMetadataObjectTypeQRCode, AVMetadataObjectTypeEAN13Code];
这篇关于AVCaptureMetadataOutput的metadataObjectTypes属性的常量吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!