【发布时间】:2014-04-25 08:35:59
【问题描述】:
我正在使用 zbar sdk 来扫描条形码。问题是有时它在尝试打开相机视图时冻结。可能需要 1-4 分钟。它太长而且很烦人,但有时它会很快打开。我该如何解决这个问题?谢谢。
-(void)barcodeRead
{
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 presentViewController: reader
animated: YES completion:nil];
}
- (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)
break;
// EXAMPLE: do something useful with the barcode image
if(whichbtn==1){pushed=1;
resultText1.text=symbol.data;
resultImage1.image= [info objectForKey: UIImagePickerControllerOriginalImage];
}else{if(whichbtn==2){pushed=1;
resultText2.text=symbol.data;
resultImage2.image= [info objectForKey: UIImagePickerControllerOriginalImage];
}
}
// ADD: dismiss the controller (NB dismiss from the *reader*!)
[reader dismissViewControllerAnimated: YES completion:nil];
}
【问题讨论】:
-
邮编你试过了。
标签: ios barcode-scanner zbar-sdk