swift - 使用 UIViewControllerRepresentable 的 VNDocumentCameraViewController 的安全区域问题
问题描述
在 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()
就这样
推荐阅读
- lightningchart - heatmapGridSeries 覆盖折线图
- wordpress - 更改 wordpress base64 中的插件颜色图标?
- javascript - SvelteKit:“过滤”不是具有“订阅”方法的商店
- java - 从 org.hibernate.query.Query 类实现自定义 executeUpdate
- cocoapods - Cocoapod错误,尝试在M1上安装所有可能的方式
- r - 如何找到不包含某个值的列?
- ruby-on-rails - Ruby on Rails 部署到阿里巴巴 ECS 后无法加载
- laravel - 使用 Laravel Forge 管理 AWS;多个实例或多个站点?
- python - 使用 for 嵌套 for 循环将向量和矩阵相乘
- python - 根据 SKU 匹配两个数据框之间的项目数量