JMQRCode 1.0.2

JMQRCode 1.0.2

测试已测试
Lang语言 Obj-CObjective C
许可协议 MIT
发布最新版本2017年3月

xiaobs 维护。



JMQRCode 1.0.2

  • 作者:
  • xiaobs

OC 版:iOS 原生方法实现二维码生成与扫描(需要 iOS8 或更高版本)

功能

  • 生成普通或彩色的二维码

  • 生成带有 logo 的普通或彩色二维码

  • 仿微信扫描二维码样式

  • 可控制是否开启闪光灯

  • 从相册中获取二维码

  • 可设置扫描样式中四个边角颜色

  • 可设置扫描样式中动画线条颜色和图片

代码

  • 普通二维码生成
UIImage *image = [JMGenerateQRCodeUtils jm_generateQRCodeWithString:@"https://github.com/James-swift/JMSQRCode.git" imageSize:<#Image_Size#>];

/// 带logo
UIImage *image = [JMGenerateQRCodeUtils jm_generateQRCodeWithString:@"https://github.com/James-swift/JMSQRCode.git" imageSize:<#Image_Size#> logoImageName:<#Logo_Name#> logoImageSize:<#Logo_Size#>];
  • 彩色二维码生成
UIImage *image = [JMGenerateQRCodeUtils jm_generateColorQRCodeWithString:@"https://github.com/James-swift/JMSQRCode.git" imageSize:<#Image_Size#> rgbColor:<#QRCode_rgbColor#> backgroundColor:<#QRCode_bgColor#>];

/// 带logo
UIImage *image = [JMGenerateQRCodeUtils jm_generateColorQRCodeWithString:@"https://github.com/James-swift/JMSQRCode.git" imageSize:<#Image_Size#> rgbColor:<#QRCode_rgbColor#> backgroundColor:<#QRCode_bgColor#> logoImageName:<#Logo_Name#> logoImageSize:<#Logo_Size#>];
  • 二维码扫描视图
JMScanningQRCodeView *qrView  = [[JMScanningQRCodeView alloc] initWithFrame:self.view.bounds];
qrView.qrLineImageName        = <#Line_Image_Name#>;
qrView.backgroundColor        = [UIColor clearColor];
qrView.scanningQRCodeResult   = ^(NSString *result) {
    NSLog(@"扫描结果:%@",result);
};

[self.view addSubview:_qrView];

安装

  1. 将工程项目中的 JMQRCode 文件夹拖入自己的工程项目中;
  2. import 文件然后开始编写代码。

Podfile

pod 'JMQRCode', '~> 1.0.2'

执行以下命令

$ pod install

效果

联系方式

  • 如果在使用中遇到任何问题或有更好的建议,请通过 Issues[email protected] 邮箱联系我。

作者

James.xiao