如何使用zbar sdk知道结果类型(条形码或qrcode)?

时间:2020-11-30 07:08:58

I'm a new iphone developer, question is I want to know the sym.data 's type. Is it codebar or qrcode?

我是一个新的iphone开发者,问题是我想知道sym.data的类型。是codebar还是qrcode?

- (void) readerView: (ZBarReaderView*) view
 didReadSymbols: (ZBarSymbolSet*) syms
      fromImage: (UIImage*) img 
{
//do something useful with results and display resultText in resultViewController
for(ZBarSymbol *sym in syms) {
    imageResult3.image = img; 
    **resultText3.text = sym.data;**  
    //return resultText;
                   break;
}
}

1 个解决方案

#1


1  

sym.typeName is what you want...

sym.typeName就是你想要的......

    resultText.text = sym.typeName;
    resultText.text =  [ resultText.text stringByAppendingString:@" - " ];
    resultText.text =  [ resultText.text stringByAppendingString:sym.data ];

Take a look at the ZBar documentation, at the ZBarSymbol Class Reference.

在ZBarSymbol Class Reference中查看ZBar文档。

#1


1  

sym.typeName is what you want...

sym.typeName就是你想要的......

    resultText.text = sym.typeName;
    resultText.text =  [ resultText.text stringByAppendingString:@" - " ];
    resultText.text =  [ resultText.text stringByAppendingString:sym.data ];

Take a look at the ZBar documentation, at the ZBarSymbol Class Reference.

在ZBarSymbol Class Reference中查看ZBar文档。