Latest 0.1.2
Homepage https://github.com/safiriGitHub/QRCodeReader
License MIT
Platforms ios 8.0
Dependencies TZImagePickerController
Frameworks UIKit, AVFoundation
Authors

QRCodeReader

Introduce

二维码/条形码扫描读取,界面及交互模仿微信。相册照片选择依赖第三方库TZImagePickerController

Installation

pod "ZSQRCodeReader"

Example


- (IBAction)scanButtonClick:(id)sender {

    if ([ZSQRCodeReaderVC isReadyForCodeReader]) {
        ZSQRCodeReaderVC *codeReaderVC = [[ZSQRCodeReaderVC alloc] init];
        //@weakify(self)
        //@weakify(codeReaderVC)
        __weak typeof (self) weakSelf = self;
        __weak typeof (codeReaderVC) weakCodeReaderVC = codeReaderVC;
        codeReaderVC.completeBlock = ^(NSString *QRString) {
            //@strongify(self)
            //@strongify(codeReaderVC)
            NSLog(@"扫码result: %@", QRString);

            [weakCodeReaderVC.navigationController popViewControllerAnimated:YES];
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"扫码result" message:QRString preferredStyle:UIAlertControllerStyleAlert];
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:0 handler:nil]];
            [weakSelf presentViewController:alert animated:YES completion:nil];
        };
        codeReaderVC.errorBlock = ^(NSString * _Nullable errorMsg) {
            //@strongify(self);
            //@strongify(codeReaderVC);
            [weakCodeReaderVC.navigationController popViewControllerAnimated:YES];
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"扫码错误" message:errorMsg preferredStyle:UIAlertControllerStyleAlert];
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:0 handler:nil]];
            [weakSelf presentViewController:alert animated:YES completion:nil];
        };
        codeReaderVC.scanLabelHintString = @"将条形码放入框内,即可自动扫描";
        [self.navigationController pushViewController:codeReaderVC animated:YES];
    }else {

        UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"无法扫码" message:@"初始化失败,请重试" preferredStyle:UIAlertControllerStyleAlert];
        [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:0 handler:nil]];
        [self presentViewController:alert animated:YES completion:nil];
    }

}

Some ScreenShots

ZSQRCodeReader
ZSQRCodeReader
ZSQRCodeReader

Author

safiriGitHub, [email protected]

Latest podspec

{
    "name": "ZSQRCodeReader",
    "version": "0.1.2",
    "summary": "u4e8cu7ef4u7801/u6761u5f62u7801u626bu63cfu8bfbu53d6uff0cu754cu9762u53cau4ea4u4e92u6a21u4effu5faeu4fe1u3002",
    "description": "u4e8cu7ef4u7801/u6761u5f62u7801u626bu63cfu8bfbu53d6uff0cu754cu9762u53cau4ea4u4e92u6a21u4effu5faeu4fe1u3002u76f8u518cu7167u7247u9009u62e9u4f9du8d56u7b2cu4e09u65b9u5e93TZImagePickerController",
    "homepage": "https://github.com/safiriGitHub/QRCodeReader",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "safiriGitHub": "[email protected]"
    },
    "source": {
        "git": "https://github.com/safiriGitHub/QRCodeReader.git",
        "tag": "0.1.2"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "ZSQRCodeReaderDemo/ZSQRCodeReader/**/*.{h,m}",
    "resources": "ZSQRCodeReaderDemo/Assets/*.bundle",
    "public_header_files": "ZSQRCodeReaderDemo/ZSQRCodeReader/**/*.h",
    "frameworks": [
        "UIKit",
        "AVFoundation"
    ],
    "dependencies": {
        "TZImagePickerController": []
    }
}

Pin It on Pinterest

Share This