IOS scanning QR Code

Source: Internet
Author: User
<span id="Label3"></p><p><p>Scanning the two-dimensional code of open Source Library has many such as zbar, zxing and so On. In this zbar as an example to build QR code scanning code Application.<br>First download the Zbar SDK on GitHub<br>Address Https://github.com/bmorton/ZBarSDK<br>Open the compressed package, which has the Zbarsdk folder<br>Include the Zbarsdk folder in your project to<br>(Finder)<br>(XCode)<br>which contains a static library of LIBZBAR.A<br>Then add the framework framework and the link library (dynamic library, static Library) to the Project. In the project Properties targets? Linked frameworks and Libraries found in Summary<br>Add to<br>avfoundation.framwork, coremedia.framework, corevideo.framework, libiconv.dylib and Libzbar.a ()</p></p><p style="margin-top: 0px; margin-bottom: 0px; padding: 0px;"><p style="margin-top: 0px; margin-bottom: 0px; padding: 0px;"></p></p><p><p><br>Then introduce the header file where it is used<br>#import "ZBarSDK.h"<br>Classes that call Zbar must implement the Zbarreaderdelegate protocol<br>Such as: Uiviewcontroller <ZBarReaderDelegate><br>In-(void) imagepickercontroller: (uiimagepickercontroller*) Reader<br>Didfinishpickingmediawithinfo: (nsdictionary*) Info<br>finally, The result value is obtained through info in the Protocol Method.</p></p><strong><strong>[cpp]</strong></strong>View Plaincopy <ol style="padding: 0px; border: none; list-style-position: initial; list-style-image: initial; color: #5c5c5c; margin: 0px 0px 1px 45px !important;"> <li style="border-style: none none none solid; border-left-width: 3px; border-left-color: #6ce26c; list-style: decimal-leading-zero outside; color: inherit; margin: 0px !important; padding: 0px 3px 0px 10px !important;"><li style="border-style: none none none solid; border-left-width: 3px; border-left-color: #6ce26c; list-style: decimal-leading-zero outside; color: inherit; margin: 0px !important; padding: 0px 3px 0px 10px !important;"><span style="margin: 0px; padding: 0px; border: none; color: black;"><span style="margin: 0px; padding: 0px; border: none;">id<nsfastenumeration> results = [info objectforkey:zbarreadercontrollerresults];</span></span></li></li> <li style="border-style: none none none solid; border-left-width: 3px; border-left-color: #6ce26c; list-style: decimal-leading-zero outside; margin: 0px !important; padding: 0px 3px 0px 10px !important;"><li style="border-style: none none none solid; border-left-width: 3px; border-left-color: #6ce26c; list-style: decimal-leading-zero outside; margin: 0px !important; padding: 0px 3px 0px 10px !important;"><span style="margin: 0px; padding: 0px; border: none; color: black;">Zbarsymbol *symbol = nil;</span></li></li> <li style="border-style: none none none solid; border-left-width: 3px; border-left-color: #6ce26c; list-style: decimal-leading-zero outside; color: inherit; margin: 0px !important; padding: 0px 3px 0px 10px !important;"><li style="border-style:none None None solid; border-left-width:3px; Border-left-color: #6ce26c; List-style:decimal-leading-zero outside; color:inherit; margin:0px!important; padding:0px 3px 0px 10px!important; "><span style="margin:0px; padding:0px; border:none; color:black; ><span style=" margin:0px; padding:0px; border:none; color: #006699; font-weight:bold; ">for<span style="margin:0px; padding:0px; border:none; color:black;" (symbol in results)   < span> </span> </span> </li></li> <li style="border-style: none none none solid; border-left-width: 3px; border-left-color: #6ce26c; list-style: decimal-leading-zero outside; margin: 0px !important; padding: 0px 3px 0px 10px !important;"><li style="border-style:none None None solid; border-left-width:3px; Border-left-color: #6ce26c; List-style:decimal-leading-zero outside; margin:0px!important; padding:0px 3px 0px 10px!important; "><span style="margin:0px; padding:0px; border:none; color:black; ><span style=" margin:0px; padding:0px; border:none; color: #008200; ">// example: just grab the first barcode <span style="margin:0px; padding:0px; border:none; color:black; ">   </span> </span> </li></li> <li style="border-style: none none none solid; border-left-width: 3px; border-left-color: #6ce26c; list-style: decimal-leading-zero outside; color: inherit; margin: 0px !important; padding: 0px 3px 0px 10px !important;"><li style="border-style: none none none solid; border-left-width: 3px; border-left-color: #6ce26c; list-style: decimal-leading-zero outside; color: inherit; margin: 0px !important; padding: 0px 3px 0px 10px !important;"><span style="margin: 0px; padding: 0px; border: none; color: black;"><span style="margin: 0px; padding: 0px; border: none; color: #006699; font-weight: bold;">Break<span style="margin: 0px; padding: 0px; border: none; color: black;">; </span></span></span></li></li> <li style="border-style: none none none solid; border-left-width: 3px; border-left-color: #6ce26c; list-style: decimal-leading-zero outside; margin: 0px !important; padding: 0px 3px 0px 10px !important;"><li style="border-style: none none none solid; border-left-width: 3px; border-left-color: #6ce26c; list-style: decimal-leading-zero outside; margin: 0px !important; padding: 0px 3px 0px 10px !important;"><span style="margin: 0px; padding: 0px; border: none; color: black;"></span></li></li> <li style="border-style: none none none solid; border-left-width: 3px; border-left-color: #6ce26c; list-style: decimal-leading-zero outside; color: inherit; margin: 0px !important; padding: 0px 3px 0px 10px !important;"><li style="border-style: none none none solid; border-left-width: 3px; border-left-color: #6ce26c; list-style: decimal-leading-zero outside; color: inherit; margin: 0px !important; padding: 0px 3px 0px 10px !important;"><span style="margin: 0px; padding: 0px; border: none; color: black;"><span style="margin: 0px; padding: 0px; border: none; color: #008200;">Example:do something useful with the barcode data <span style="margin: 0px; padding: 0px; border: none; color: black;"></span></span></span></li></li> <li style="border-style: none none none solid; border-left-width: 3px; border-left-color: #6ce26c; list-style: decimal-leading-zero outside; margin: 0px !important; padding: 0px 3px 0px 10px !important;"><li style="border-style: none none none solid; border-left-width: 3px; border-left-color: #6ce26c; list-style: decimal-leading-zero outside; margin: 0px !important; padding: 0px 3px 0px 10px !important;"><span style="margin: 0px; padding: 0px; border: none; color: black;">Resulttext.text = symbol.data;</span></li></li> </ol><p><p><br>Document Address http://zbar.sourceforge.net/iphone/sdkdoc/<br>QR Code Open Source Library The zxing process is similar, but zxing does not support scanning of one-dimensional code by default, and Zbar is Supported.</p></p><p><p>IOS scanning QR Code</p></p></span>

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.