首页 > 解决方案 > 为 VNDocumentCameraViewController Swift 保存按下的操作

问题描述

只是想知道是否有人知道如何在用户按下 VNDocumentCameraViewController 中的保存按钮时添加操作。我只希望用户只能扫描一个文档,然后视图应该自行关闭。

我现在有这个功能...

@objc func scanDocument() {
        let scannerViewController = VNDocumentCameraViewController()
        scannerViewController.delegate = self

        present(scannerViewController, animated: true)
    }

除了两个动作,它们的格式都像......

 func documentCameraViewController(_ controller: VNDocumentCameraViewController, didFinishWith scan: VNDocumentCameraScan) {

            }

但是对于“DidPressSave”或类似的东西,似乎没有相同格式的操作,只有“didFailWithError”。我什至跳到定义,发现他们只有这两个。所以想知道是否有这种方法可以添加这种操作或将用户限制为仅一次扫描?

谢谢,乔丹。

标签: iosswiftvndocumentcameraviewcontroller

解决方案


目前无法设置要扫描的页数限制。

您可以在VNDocumentCameraViewController类和委托VNDocumentCameraViewControllerDelegate的文档中看到它。

如果您愿意,可以尝试使用WeScan


推荐阅读