HHBarCodeViewController 1.0.1

HHBarCodeViewController 1.0.1

测试已测试
语言语言 Obj-CObjective C
许可 MIT
发布最新版本2014年12月

Harlan Haskins 管理。



HHBarCodeViewController 是一个使用 iOS 7 原生条形码扫描 API 的快速模态条形码阅读器。

最初是为了我自己使用,因为找到的唯一实现只有 博客文章 中的代码片段,所以我将这段代码合并在一起,制作成一个易于展示且具有花哨代理回调的模态视图控制器。

好耶。

安装

通过 CocoaPods 安装最简单。只需将以下行添加到您的 Podfile: pod 'HHBarCodeViewController'

使用方法

使用方法很简单。只需使用 [HHBarCodeViewController new] 实例化 HHBarCodeViewController 并展示或推送它。当识别到条形码时,代理方法 barCodeViewController:didDetectBarCode: 或块 detectedBarCodeBlock() 将被调用。

如果您使用返回的条形码,强烈建议您在关闭 ViewController 后在完成中进行操作。这将防止重复动作,因为 HHBarCodeViewController 在其生命周期中多次调用该代理方法。

如下所示

- (void) barCodeViewController:(UIViewController *)barCodeViewController didDetectBarCode:(NSString *)barCode {
    [self dismissViewControllerAnimated:YES completion:^{
        dataTextView.text = barCode;
    }];
}

作者

Harlan Haskins (@harlanhaskins)

许可

HHBarCodeViewController 可在 MIT 许可证下使用,此副本在名为 LICENSE 的文件中。