在我的应用程序中,Zbar 完美解码。但问题是Zbar可以同时解码二维码和条形码。那么解码后,如何获取Encoding Style的类型呢?
问问题
1379 次
2 回答
4
ZBarSymbol 中有类型的返回码。您将寻找用于 QR 码的 ZBAR_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;
resultText.text = sym.typeName;
resultText.text = [ resultText.text stringByAppendingString:@" - " ];
resultText.text = [ resultText.text stringByAppendingString:sym.data ];
}
}
于 2013-09-03T09:02:51.113 回答
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
}
于 2013-09-04T05:01:20.470 回答