BarCode Reader不检测当我将它放在实时对象上时

时间:2012-12-20 13:16:30

标签: ios xcode zbar-sdk

我正在使用此代码来检测条形码。代码是

- (IBAction) scanButtonTapped
{
    NSLog(@"TBD: scan barcode here...");
// ADD: present a barcode reader that scans from the camera feed
    ZBarReaderViewController *reader = [ZBarReaderViewController new];
    reader.readerDelegate = self;
    reader.supportedOrientationsMask = ZBarOrientationMaskAll;

    ZBarImageScanner *scanner = reader.scanner;
    // TODO: (optional) additional reader configuration here

    // EXAMPLE: disable rarely used I2/5 to improve performance
    [scanner setSymbology: ZBAR_I25
                   config: ZBAR_CFG_ENABLE
                       to: 0];

    // present and release the controller
    [self presentModalViewController: reader
                            animated: YES];
    [reader release];
}

- (void) imagePickerController: (UIImagePickerController*) reader
 didFinishPickingMediaWithInfo: (NSDictionary*) info
{
    // ADD: get the decode results
    id<NSFastEnumeration> results =
    [info objectForKey: ZBarReaderControllerResults];
    ZBarSymbol *symbol = nil;
    for(symbol in results)
        // EXAMPLE: just grab the first barcode
        break;

    // EXAMPLE: do something useful with the barcode data
    resultText.text = symbol.data;

    // EXAMPLE: do something useful with the barcode image
    resultImage.image =
    [info objectForKey: UIImagePickerControllerOriginalImage];

    // ADD: dismiss the controller (NB dismiss from the *reader*!)

    [reader dismissViewControllerAnimated:YES completion:nil];
}

它在这些links上工作得很好但是如果我把我的ipod触控相机放在像条件包,iPhone案件这样的真实条码上......它没有检测到。请告诉我如何解决这个问题。谢谢。任何想法,将不胜感激 。如果我的问题不明确,请告诉我。

0 个答案:

没有答案