在 UIViewControllerRepresentable 中使用 VNDocumentCameraViewController 时,如何将相机扫描 View 扩展到 safa 区域?
这是代码
struct ScanDocumentView: UIViewControllerRepresentable {
func makeCoordinator() -> Coordinator {
Coordinator(recognizedText: $recognizedText, parent: self)
}
func makeUIViewController(context: Context) -> VNDocumentCameraViewController {
let documentViewController = VNDocumentCameraViewController()
documentViewController.delegate = context.coordinator
return documentViewController
}
func updateUIViewController(_ uiViewController: VNDocumentCameraViewController, context: Context) {
// nothing to do here
}
}
最佳答案
问题解决了!只需添加
.ignoresSafeArea()
下
ScanDocumentView()
仅此而已
关于swift - 使用 UIViewControllerRepresentable 的 VNDocumentCameraViewController 的安全区域问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65750820/