在我的应用程序中,Zbar完美解码。但问题是Zbar可以解码QR码和条形码。所以解码后如何获得编码样式的类型?
提前致谢
答案 0 :(得分:3)
ZBar符号中有类型的返回码。您将在寻找QR码的ZBAR QR CODE
这样的事情可以帮助你解决这个问题:
- (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;
resultText.text = sym.typeName;
resultText.text = [ resultText.text stringByAppendingString:@" - " ];
resultText.text = [ resultText.text stringByAppendingString:sym.data ];
}
}
答案 1 :(得分:0)
我做的是,
- (void) imagePickerController: (UIImagePickerController*) reader didFinishPickingMediaWithInfo: (NSDictionary*) info
{
UIImage *image = [info objectForKey: UIImagePickerControllerOriginalImage];
ZBarImage *zImage = [[ZBarImage alloc] initWithCGImage:image.CGImage];
ZBarImageScanner *scanner = [[ZBarImageScanner alloc] init];
[scanner setSymbology: ZBAR_I25
config: ZBAR_CFG_ENABLE
to: 0];
[scanner scanImage:zImage];
ZBarSymbolSet *set = [scanner results];
ZBarSymbol *symbol = nil;
for (symbol in set)
break;
codeType.text = symbol.typeName
}