Scan QR code and barcode functionality with ZBARSDK (IOS)

Source: Internet
Author: User

1. Download the latest version of the Zbar SDK from Http://zbar.sourceforge.net/iphone.

2. Double-click the downloaded file. The current version is: ZBARSDK-1.2.DMG.

3. Follow the prompts to drag and drop the ZBARSDK into our own project.

4. Using ZBARSDK, you also need to import additional frameworks.

Project, target, build phases, Link Binary with Libraries Click + Add the following frame Work

1>. Avfoundation.framework

2>. Coremedia.framework

3>. Corevideo.framework

4>. Quartzcore.framework

5>.libiconv.dylib

5. Import header file: #import "ZBarSDK.h"

6. Claims support Proxy Protocol:<zbarreaderdelegate>

7. Writing code:

- (void) viewdidload {[Super viewdidload]; //Do any additional setup after loading the view.Self.title=@"Two-dimensional code scanning"; Uiimageview* ImageView =[[Uiimageview alloc] init]; [ImageView Setframe:cgrectmake ( -,162,424,424)];    [Self.view Addsubview:imageview]; Self.resultimage=ImageView; [Self scan];}- (void) scan{
Zbarreaderviewcontroller* reader =[[Zbarreaderviewcontroller alloc] init]; Reader.readerdelegate=Self ; Reader.supportedorientationsmask=Zbarorientationmaskall; Zbarimagescanner* Scanner =Reader.scanner; [Scanner setsymbology:zbar_i25 config:zbar_cfg_enable to:0]; [Self Presentviewcontroller:reader animated:yes completion:nil];}- (void) Imagepickercontroller: (Uiimagepickercontroller *) Picker Didfinishpickingmediawithinfo: (NSDictionary *) info{

// Get barcode Results
ID<NSFastEnumeration> results = [info objectforkey:zbarreadercontrollerresults];     * symbol = nil;      for inch results) {        break;    }

Printing Barcodes

    = [Info objectforkey:uiimagepickercontrolleroriginalimage];        [Picker Dismissviewcontrolleranimated:yes Completion:nil];    

exit the Scan interface

    MyLog (@ "result:%@", Symbol.data);}

Scan QR code and barcode functionality with ZBARSDK (IOS)

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.