ZBARSDK using two-dimensional code scanning recognition

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.