Import the necessary framework
1. Quick Integration
Implementing the Zbarreaderdelegate Protocol
QR Code recognition-(void) sysbutbuttonclick{ //Initialize camera controller zbarreaderviewcontroller *reader = [zbarreaderviewcontroller new]; //Setup Agent reader.readerDelegate = self; //Basic Fit reader.supportedOrientationsMask = ZBarOrientationMaskAll; //QR Code/barcode Recognition Settings zbarimagescanner * Scanner = reader.scanner; [scanner setsymbology: ZBAR_I25 config: ZBAR_CFG_ENABLE to: 0]; //pop-up system camera, full screen shooting [Self presentviewcontroller:reader animated:yes completion:nil];} - (void) imagePickerController: (uiimagepickercontroller*) reader didfinishpickingmediawithinfo: (nsdictionary*) info { nslog (@ "info=%@", info); // Get Barcode Results id<NSFastEnumeration> results =[info objectforkey: zbarreadercontrollerresults]; ZBarSymbol *symbol = nil; for (symbol in results) // EXAMPLE: just grab the first barcode &Nbsp; break; nslog (@ "%@", Symbol.data);}
2 Customizing Windows
Implementing the Zbarreaderviewdelegate Protocol
QR Code recognition-(void) sysbutbuttonclick{ //Initialize camera window ZBarReaderView *readview = [ZBarReaderView new]; //Custom Size readview.frame = myscreen; // Custom Add related instructions ..... Play the imagination of the respective app //here omit to beautify the 10000 lines of code .... ... //... ..... ..... ........ ............... // good to go to the point-- then set up a proxy readview.readerdelegate = self; //add its camera capture view to the view you want to display [ self.view addsubview:readview]; // QR Code/Barcode Recognition Settings ZBarImageScanner *scanner = readview.scanner; [scanner setSymbology: ZBAR_I25 config: zbar_cfg_enable to: 0]; //boot, must start after The real-time images taken by mobile phone photographers can be displayed on Readview [readview start];} -(void) Readerview: (zbarreaderview *) Readerview didreadsymbols: (zbarsymbolset *) symbols FromImage: (uiimage *) image{ zbarsymbol *symbol = nil; for (Symbol in symbols) { break ; } nslog (@ "========%@==========", Symbol.data);}
ZBARSDK using two-dimensional code scanning recognition