【问题标题】:checking barcode value in Zbar SDK?检查 Zbar SDK 中的条形码值?
【发布时间】:2011-09-10 18:03:16
【问题描述】:

我在 iphone 中使用 Zbar SDK。是否可以在相机模式下通过任何委托方法找出无效条形码?例如,如果我在相机模式下使用普通纸(不是条形码),我必须在相机模式下显示无效条形码一段时间后,ZBar SDK 采取了哪些措施?我尝试了以下方法,但教程说它是用于扫描照片库图像。

- (void) readerControllerDidFailToRead: (ZBarReaderController*) reader
                             withRetry: (BOOL) retry.

【问题讨论】:

    标签: iphone ipad ios4 barcode


    【解决方案1】:

    对于相机模式,ZBar 没有在指定时间范围后失败的概念。你必须定义它。

    我会定义一个类似这样的方法:

    - (void)checkIfScanComplete {
       if(zbarWidgetController.decoding) {  // you may have to add a property for decoding
                                            // alternatively, check if captureSession == nil
          [zbarWidgetController cancelled]; // cancelled is part of CancelDelegate protocol
          // show your error message, but on be sure you do it on main thread
       }
    }
    

    然后像这样在任意时间间隔之后调用它:

    [self performSelector:@selector(checkIfScanComplete) withObject:nil afterDelay:yourTimeInterval];
    

    【讨论】:

    • 它可以在相机模式下在 Zbar sdk 中工作吗?我的意思是从相机自动对焦以获取条形码?我没有要求从照片库拍摄的图像?
    • 根据您的评论更新。 ZBar 无法知道何时认为实时扫描“失败”,因此您必须定义它。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多