(Finder)
(XCode)
其中包含一个libzbar.a的静态库
接着往项目中添加Framework框架及链接库(动态库、静态库)。
在项目属性TARGETSSummary 中找到Linked Frameworks and Libraries 添加
AVFoundation.framwork, CoreMedia.framework, CoreVideo.framework, libiconv.dylib 和libzbar.a (如图)
然后在使用的地方引入头文件
#import "ZBarSDK.h"
id<NSFastEnumeration> results = [info objectForKey: ZBarReaderControllerResults]; ZBarSymbol *symbol = nil; for(symbol in results) // EXAMPLE: just grab the first barcodebreak; // EXAMPLE: do something useful with the barcode dataresultText.text = symbol.data; [cpp] view plaincopyid<NSFastEnumeration> results = [info objectForKey: ZBarReaderControllerResults]; ZBarSymbol *symbol = nil; for(symbol in results) // EXAMPLE: just grab the first barcode break;// EXAMPLE: do something useful with the barcode data resultText.text = symbol.data;文档地址http://zbar.sourceforge.net/iphone/sdkdoc/
设置头文件路径,在TARGET中building settings Search Path
当然也可以直接将库编译成静态库libQREcoder.a
然后在包含进来
接着在Frameworks 中添加静态库的引用
然后在使用该库的地方包含头文件
#import <QREncoder/QREncoder.h>
UIImage* image = [QREncoder encode:@"http://www.baidu.com/"]; UIImage* image = [QREncoder encode:@"http://www.baidu.com/"];
以上内容就是教大家如何在iphon IOS设备上使用二维码,希望大家喜欢。