How to get code type from zbar?

In my application, Zbar decodes perfectly. But the problem is that Zbar can decode both a QR code and a barcode. So, after decoding How to get the type of coding style?

early

+4
source share
2 answers

ZBarSymbol has return codes for the type. You will search for ZBAR_QRCODE for QR codes

ZBarSymbol Documentation

Something like this should help you get the character:

- (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 ]; } } 
+3
source

What I've done,

 - (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 } 
0
source

Source: https://habr.com/ru/post/1500264/


All Articles