YLOCScan
示例
要运行示例项目,请克隆仓库,然后从Example目录运行pod install
。
要求
安装
YLOCScan可通过CocoaPods获得。要安装它,只需将以下行添加到您的Podfile中
pod 'YLOCScan'
作者
hoggenw,[email protected]
许可
YLOCScan 遵循 MIT 许可。更多信息见 LICENSE 文件。
##调用方法 注意要在.plist设置相机相关的权限
//初始化
YLScanViewManager * manager = [YLScanViewManager sharedInstance];
//视图UI相关的设置更改,可以不做设置,使用默认配置
// 是否需要边框
//manager.isNeedShowRetangle = true;
//扫描框的宽高比
// manager.whRatio = 1;
//相对中心点Y的偏移
//manager.centerUpOffset = -20;
//扫描框的宽度
// manager.scanViewWidth = 160;
//扫描框的颜色
//manager.colorRetangleLine = UIColor.red;
//扫码区域4个角的线条宽度
//manager.photoframeLineW = 4;
//自定义扫描动画
manager.animationImage = image;
//添加扫描成功返回代理
manager.delegate = self;
//扫描动画的样式,自带4种样式
manager.imageStyle = secondeNetGrid;
[manager showScanView: self];
在 YLScanViewControllerDelegate 的代理中处理成功后返回的数据
-(void)scanViewControllerSuccessWith:(YLScanResult *)result {
NSLog(@"wlg====%@", result.strScanned);
}
二维码的生成
YLScanViewManager * manager = [YLScanViewManager sharedInstance];
UIView *codeView = [manager produceQRcodeView:CGRectMake((self.view.bounds.size.width - 200)/2, (self.view.bounds.size.width - 200)/2, 200, 200) logoIconName:@"device_scan" codeMessage:@"wlg's test Message"];
[self.view addSubview:codeView];