一、下载 libqrencode SDK
1.以从github上下载好ZBarSDK,导入项目,并且导入相关iOS.framework 如图:
2.在ViewController.m中导入头文件
#import "QRCodeGenerator.h"
#import "ZBarSDK.h"
3.导入协议ZBarReaderDelegate
- (IBAction)sss:(id)sender {
//初始化相机控制器
reader = [ZBarReaderViewController new];
//设置代理
reader.readerDelegate = self;
//基本适配
reader.supportedOrientationsMask = ZBarOrientationMaskAll;
//二维码/条形码识别设置
ZBarImageScanner *scanner = reader.scanner;
[scanner setSymbology: ZBAR_I25
config: ZBAR_CFG_ENABLE
to: 0];
//弹出系统照相机,全屏拍摄
[self presentModalViewController: reader
animated: YES];
}
4、在Info.plist中导入
使用相机NSCameraUsageDescription
网友评论