【问题标题】:IOS: how to take picture of scanned barcode?IOS:如何对扫描的条码拍照?
【发布时间】:2016-09-26 17:03:38
【问题描述】:

我正在尝试从相机捕获已扫描条形码的图像,但找不到路。

func captureOutput(captureOutput: AVCaptureOutput!, didOutputMetadataObjects metadataObjects: [AnyObject]!, fromConnection connection: AVCaptureConnection!) {


for   metadata: AVMetadataObject in (metadataObjects as? [AVMetadataObject])!{
            for   type: String in barCodeTypes {
                if  metadata.type == barcodeType
                {
                 //do something and break
                }
           }
}

该方法在条码扫描成功时调用,我需要获取扫描条码的UIImage。帮我解决这个问题。

【问题讨论】:

  • 您是否要求能够保存条形码的照片?
  • @MwcsMac 是的,我需要获取扫描条码的 UIImage
  • 您同时在谈论相机的两种不同用途。要拍照,您需要使用与条形码功能不同的UIImagePickerController
  • 您找到解决方案了吗?我很感兴趣。

标签: ios swift barcode-scanner


【解决方案1】:

您可以向会话添加另一个输出,例如 AVCaptureStillImageOutput,当检测到 qr 时,使用方法 captureStillImageAsynchronously 拍照。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多