gpt4 book ai didi

iphone - 如何在ipod中使用前置摄像头进行条码扫描

转载 作者:太空狗 更新时间:2023-10-30 03:42:01 26 4
gpt4 key购买 nike

我正在使用后置摄像头读取条码数据...并且扫描效果非常好。现在我想使用前置摄像头...我该怎么做?我应该在哪里找零?我用过ZBar条码阅读器

我的代码是:

   - (IBAction) scanButtonTapped
{
// 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;
bid.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 dismissModalViewControllerAnimated: YES];
}

最佳答案

如果我对你的问题的理解正确,你所要做的就是打开你的相机,使其处于前置模式而不是后置模式,所以在你第一次调用选择器的方法中写这个:

  picker.cameraDevice=UIImagePickerControllerCameraDeviceFront;

希望这能回答您的问题。如果没有,请告诉我。

关于iphone - 如何在ipod中使用前置摄像头进行条码扫描,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9237962/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com