簡體   English   中英

使用 UIViewControllerRepresentable 的 VNDocumentCameraViewController 的安全區域問題

[英]Safe area issue with VNDocumentCameraViewController using UIViewControllerRepresentable

在 UIViewControllerRepresentable 中使用 VNDocumentCameraViewController 時,如何將相機掃描視圖擴展到 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()

就這樣

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM