Latest 0.3.4
Homepage https://github.com/ws00801526/XMNQRCode
License MIT
Platforms ios 8.0, requires ARC
Authors

XMNQRCode 基于AVFoundation,CoreImage封装的一个二维码,条形码扫描,生成工具

  • [x] 二维码扫描功能, 默认支持二维码,条形码扫描功能, 可自行配置
  • [x] 二维码,条形码生成功能, 可自行配置生成的二维码图片(包含边角样式,中间图片等), 可配置条形码是否显示文字
  • [x] 二维码扫描功能, 可自动识别光线亮度, 显示闪光灯开启功能, 可点击改变曝光度

安装方法

  1. pod 'XMNQRCode' 使用pod方式安装XMNQRCode类库

使用示例

  1. 唤起二维码扫描界面
     __weak typeof(self) wSelf = self;
     //1. 创建reader实例
    XMNQRCodeReaderController *rederC = [[XMNQRCodeReaderController alloc] initWithCompletionHandler:^(NSString *result) {
    //2. 处理扫描结果
        __strong typeof(wSelf) self = wSelf;
        SFSafariViewController *controller = [[SFSafariViewController alloc] initWithURL:[NSURL URLWithString:result]];
        [self.navigationController pushViewController:controller animated:YES];
    }];
    [self.navigationController pushViewController:rederC animated:YES];
  1. 二维码生成
//1. 创建二维码生成器   
XMNQRCodeBuilder *builder = [[XMNQRCodeBuilder alloc] initWithInfo:@"https://www.baidu.com" size:CGSizeMake(300, 300)];
//2. 配置样式参数
builder.outerColor = [UIColor cyanColor]; 
//3. 生成二维码(二维码只支持lating1 字符集), 条形码(注意条形码只支持ASCII字符集)
// 可参考文档 [Xcode文档](xcdoc://?url=developer.apple.com/library/content/documentation/GraphicsImaging/Reference/CoreImageFilterReference/index.html#//apple_ref/doc/uid/TP30000136-SW310)
UIImage *image = builder.QRCodeImage;
UIImage *barImage = builder.barCodeImage;

//4. 异步生成二维码
[self.builder generateCodeImageWithMode:XMNQRCodeBuilderCodeModeQRCode
                          completionHandler:^(UIImage * _Nullable image) {
                             //生成的对应条形码或者二维码图片 
                          }];
//更多样式定义 参考demo

Latest podspec

{
    "name": "XMNQRCode",
    "version": "0.3.4",
    "summary": "u4f7fu7528u7cfbu7edfapiu5b9eu73b0u4e8cu7ef4u7801u626bu63cfu529fu80fd,u4e8cu7ef4u7801u56feu7247u8bc6u522bu529fu80fd, u589eu52a0u4e8cu7ef4u7801,u6761u5f62u7801u751fu6210u529fu80fd",
    "homepage": "https://github.com/ws00801526/XMNQRCode",
    "license": "MIT",
    "authors": {
        "XMFraker": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/ws00801526/XMNQRCode.git",
        "tag": "0.3.4"
    },
    "source_files": "XMNQRCode/Classes/*.{h,m}",
    "public_header_files": [
        "XMNQRCode/Classes/XMNQRCode.h",
        "XMNQRCode/Classes/XMNQRCodeBuilder.h",
        "XMNQRCode/Classes/XMNQRCodeReaderController.h"
    ],
    "resources": "XMNQRCode/Resources/*.{png,jpg}",
    "requires_arc": true,
    "ios": {
        "frameworks": "CoreImage"
    }
}

Pin It on Pinterest

Share This