2 Star 7 Fork 4

reesun1130 / SYQRCodeDemo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

QRCode Demo

SYQRCodeDemo:仿微信二维码扫描

Latest

  • swift实现:SYQRCodeDemoSwift
  • 修复bug,优化实现和用户体验,更加简单易用(新增类似微信的打开动画效果)
  • 修改相机权限判断
  • 添加新的类,拆分view
  • 使用时直接拖动SYQRCodeViewController文件夹到工程里面即可
  • 7.0及以上系统:如果只是简单的扫描二维码不需要添加第三方库,移除ZXingObjC即可

New

  • 支持读取图片二维码;

    需要支持iOS 7及以上系统则需依赖ZXingObjC

    iOS >= 8.0,直接采用系统的即可;

  • 支持开启闪光灯

  • 支持生成二维码图片

Introduction:基于SYQRCodeDemo

intro png

Example:将SYQRCodeViewController拖入工程即可使用

NSData *stringData = [text dataUsingEncoding: NSUTF8StringEncoding];
//生成
CIFilter *qrFilter = [CIFilter filterWithName:@"CIQRCodeGenerator"];
[qrFilter setValue:stringData forKey:@"inputMessage"];
[qrFilter setValue:@"M" forKey:@"inputCorrectionLevel"];

UIColor *onColor = [UIColor whiteColor];
UIColor *offColor = [UIColor darkGrayColor];

//上色
CIFilter *colorFilter = [CIFilter filterWithName:@"CIFalseColor"
                                   keysAndValues:
                         @"inputImage",qrFilter.outputImage,
                         @"inputColor0",[CIColor colorWithCGColor:onColor.CGColor],
                         @"inputColor1",[CIColor colorWithCGColor:offColor.CGColor],
                         nil];

CIImage *qrImage = colorFilter.outputImage;

//绘制
CGSize size = CGSizeMake(width, width);
CGImageRef cgImage = [[CIContext contextWithOptions:nil] createCGImage:qrImage fromRect:qrImage.extent];
UIGraphicsBeginImageContext(size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetInterpolationQuality(context, kCGInterpolationNone);
CGContextScaleCTM(context, 1.0, -1.0);
CGContextDrawImage(context, CGContextGetClipBoundingBox(context), cgImage);
_codeImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

CGImageRelease(cgImage);

空文件

简介

/**SYQRCode:IOS原生API,需要IOS7.0及以上系统支持。 用法: //扫描二维码 SYQRCodeViewController *aaa = [[SYQRCodeViewController alloc] init]; aaa.SYQRCodeSuncessBlock = ^(NSString *qrString){ self.saomiaoLabel.text = qrString; }; aaa.SYQRCodeCancleBlock = ^(SYQRCodeViewController *are){ self.saomi... 展开 收起
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Objective-C
1
https://gitee.com/reesun1130/SYQRCodeDemo.git
git@gitee.com:reesun1130/SYQRCodeDemo.git
reesun1130
SYQRCodeDemo
SYQRCodeDemo
master

搜索帮助