In the course of iOS development, it is sometimes necessary to use QR code scanning and QR code generation, and now introduce my own test and pass method:
(a) Two-dimensional code generation mode:
Need tools: Libqrencode Library, qrcodegenerator.h,qrcodegenerator.m file, to tell the truth, find these two files on the internet really wasted a lot of my kung fu, the following I will put the detailed paste, I believe that will save you a lot of time.
With the above two files you can add it to your project and use the appropriate interface API to complete the function.
Imageview.image = [Qrcodegenerator qrimageforstring:string imageSize:imageview.bounds.size.width];
(ii) Two-dimensional code recognition: there are commonly used Zbar and zxing two ways, about the difference between the two methods and pros and cons believe that we can search Baidu, here is not described.
(1) How to use Zbar:
Download the Zbar SDK and import it into the project, add the appropriate framework to the project, as for the added method, have done iOS development believe all know that Avfoundation.framework,coremedia.framework,corevideo.framework, quartzcore.framework, Libiconv.dylib.
When using Zbar, there is an important problem is that the official is not support 64-bit, so we need to recompile the downloaded file, about how to compile the following there are several good solutions:
http://www.cocoachina.com/bbs/read.php?tid=233263 The original author of this blog has given several solutions, we can refer to, I have only measured the following this way,
http://blog.diogot.com/blog/2013/09/18/static-libs-with-support-to-ios-5-and-arm64/specific recompile static library methods are described in detail in this blog post.
This is my own compilation, has been determined to run on the Iphone6 simulator, specifically: http://pan.baidu.com/s/1nt5lG9r
(2) ZXing (pending study)
about how IOS QR code is created and scanned (Ios,zbar supports 64-bit solutions)