基于LBXScan进行的扫码封装,更加简化了实用方式,两行代码即可实现扫码功能 1.首先在项目中pod如下库
pod 'ZXingObjC', '~> 3.0'
pod 'LBXAlertAction'
pod 'ZYCornerRadius', git:'https://github.com/liuzhiyi1992/ZYCornerRadius.git',tag:'0.9.1'
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
4.在需要实现扫码的地方导入头文件
#import 'ScanHelper.h'
@interface ViewController ()<ScanStyleDelegate>
//如果想自定义样式在ScanHelper中修改即可,论文,将“qqStyle”替换为相应样式名称
[ScanHelper shareInstance].delegate = self;
[[ScanHelper shareInstance] goScanWithStyle:@"qqStyle"];
#pragma mark ScanHelper 代理方法
- (void)pushScanController:(UIViewController *)controller{
[self.navigationController pushViewController:controller animated:YES];
}
- (void)showNextVCWithScanResult:(LBXScanResult*)strResult
{
//这里处理扫描结果
}
<key>NSCameraUsageDescription</key>
<string>是否允许使用相机</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>是否允许打开相册</string>