[英]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.