首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用UIViewControllerRepresentable的VNDocumentCameraViewController的安全区域问题

使用UIViewControllerRepresentable的VNDocumentCameraViewController的安全区域问题
EN

Stack Overflow用户
提问于 2021-01-16 22:35:00
回答 1查看 153关注 0票数 1

在UIViewControllerRepresentable中使用VNDocumentCameraViewController时,如何将相机扫描视图扩展到safa区域?

以下是代码

代码语言:javascript
复制
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
    }
}

下面是底部安全区域为空的行为

EN

回答 1

Stack Overflow用户

发布于 2021-01-19 13:30:02

问题解决了!只需添加

代码语言:javascript
复制
.ignoresSafeArea()

在……下面

代码语言:javascript
复制
ScanDocumentView()

仅此而已

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65750820

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档