我想使用 iPhone 相机测试我的条码扫描器。
我正在使用 ZBar SDK 进行条码扫描。
我有一个扫描按钮。当我点击扫描按钮时,它向我显示消息,“相机模拟,用两根手指点击并按住以选择图像”。当我这样做时,它显示“无照片”另一种看法。
我正在这样做:
-(IBAction) scanButtonTapped
{
//Barcode reader that scans from camara feed
reader = [ZBarReaderViewController new];
reader.readerDelegate = self;
reader.supportedOrientationsMask = ZBarOrientationMaskAll;
ZBarImageScanner *scanner = reader.scanner;
//disable rarely used I2/5 to improve performance
[scanner setSymbology:ZBAR_QRCODE config:ZBAR_CFG_ENABLE to:0];
reader.readerView.zoom = 1.0;
//present and release the controller
[self presentModalViewController:reader animated:YES];
}
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
//get decode result
id<NSFastEnumeration> results = [info objectForKey:ZBarReaderControllerResults];
ZBarSymbol *symbol = nil;
for (symbol in results) {
break;
}
resultText.text = symbol.data;
resultImage.image = [info objectForKey:UIImagePickerControllerOriginalImage];
[reader dismissModalViewControllerAnimated:YES];
}
我正在尝试扫描二维码。
谁能告诉我如何选择条形码图像并使用模拟器扫描它?
谢谢。