Latest 1.2.3
Homepage https://github.com/zachariahlee/ZHBarTool
License MIT
Platforms ios 8.0, requires ARC
Frameworks UIKit, AVFoundation, CoreImage
Authors

原生封装二维码、条形码扫描工具;生成、识别(彩色)二维码、条形码图片

生成二维码

UIImage *image = [ZBarTool encodeQRCodeImageWithContent:@"https://www.apple.com" size:300 backgroundColor:[UIColor clearColor] themeColor:[UIColor purpleColor] insetImage:[UIImage imageNamed:@"beautiful"] imageCornerRadius:50];
self.imageView.image = image;

识别二维码

NSString *content = [ZBarTool decodeQRCodeImage:self.imageView.image];
self.label.text = content;

扫描

ZBarTool *tool = [ZBarTool barTool];  
[tool startScanBarWithScanRect:self.scanRect scanType:ZBarScanTypeAll layerView:self.view];
tool.scanBarGetObject = ^(NSString * _Nonnull objects) {
  NSLog(@"%@", objects);
};

生成条形码

UIImage *image = [ZHBarTool encodeBarcodeImageWithContent:@"12345678" size:CGSizeMake(self.view.frame.size.width-20, 100) color:[UIColor yellowColor]];
self.barcodeImageView.image = image;

内部有封装好的扫描视图,可以直接使用

ZBarSacnView *scanView = [[ZBarSacnView alloc] initWithFrame:self.view.bounds scanRect:self.scanRect];
[self.view addSubview:scanView];
[scanView startScanBar];

更多使用方法详见Demo

Latest podspec

{
    "name": "ZHBarTool",
    "version": "1.2.3",
    "summary": "u4e8cu7ef4u7801u5de5u5177",
    "description": "u539fu751fu5c01u88c5u4e8cu7ef4u7801u3001u6761u5f62u7801u626bu63cfu5de5u5177uff1bu751fu6210u3001u8bc6u522buff08u5f69u8272uff09u4e8cu7ef4u7801u56feu7247",
    "homepage": "https://github.com/zachariahlee/ZHBarTool",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "zachariahlee": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/zachariahlee/ZHBarTool.git",
        "tag": "1.2.3"
    },
    "source_files": "Pod/Classes/*.{h,m}",
    "resources": "Pod/Assets/*.{png,xib,nib,bundle}",
    "frameworks": [
        "UIKit",
        "AVFoundation",
        "CoreImage"
    ],
    "requires_arc": true
}

Pin It on Pinterest

Share This