Latest 1.0.0
Homepage https://github.com/li125434104/XJScanQRCode
License MIT
Platforms ios 9.0
Authors

CI Status
Version
License
Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

XJScanQRCode is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'XJScanQRCode'

How to user

//输出流视图
    UIView *preview  = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    [self.view addSubview:preview];

    self.scanView = [[XJScanView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    [self.view addSubview:self.scanView];
    [self.scanView showFlashSwitch:YES];

    __weak typeof(self) weakSelf = self;

    self.scanTool = [[XJScanTools alloc] initWithPreview:preview andScanFrame:self.scanView.scanSweepAreaRect];
    [self.scanTool sessionStartRunning];
    self.scanTool.scanFinishedBlock = ^(NSString *scanString) {
        NSLog(@"扫描结果:%@",scanString);
        [weakSelf.scanView handlingResultsOfScan];
        [weakSelf.scanTool sessionStopRunning];

    };
    self.scanTool.monitorLightBlock = ^(float brightness) {
        NSLog(@"环境光感 : %f",brightness);
        if (brightness < 0) {
            // 环境太暗,显示闪光灯开关按钮
            [weakSelf.scanView showFlashSwitch:YES];
        }else if(brightness > 0){
            // 环境亮度可以,且闪光灯处于关闭状态时,隐藏闪光灯开关
            if(!weakSelf.scanTool.flashOpen){
                [weakSelf.scanView showFlashSwitch:NO];
            }
        }
    };

Author

li125434104, [email protected]

License

XJScanQRCode is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "XJScanQRCode",
    "version": "1.0.0",
    "summary": "A short description of XJScanQRCode.",
    "description": "TODO: Add long description of the pod here.",
    "homepage": "https://github.com/li125434104/XJScanQRCode",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "li125434104": "[email protected]"
    },
    "source": {
        "git": "https://github.com/li125434104/XJScanQRCode.git",
        "tag": "1.0.0"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "XJScanQRCode/Classes/**/*"
}

Pin It on Pinterest

Share This