ios - UIDocumentPickerViewController 在框架中初始化时将文件显示为灰色
问题描述
我想从框架初始化 UIDocumentPickerViewController。但是,在框架中使用以下代码时,文件 (.pdf) 在文档选择器中显示为灰色。当 UIDocumentPickerViewController 在主应用程序目标中初始化时,代码工作正常。这就是我使用的。
let documentPicker = UIDocumentPickerViewController(forOpeningContentTypes: [.pdf])
documentPicker.delegate = self
present(documentPicker, animated: true, completion: nil)
解决方案
正如您UIDocumentPickerViewController
在框架中所拥有的那样,更好的方法是使用custom UIViewController
和实现UIDocumentPickerViewController
该视图控制器中的所有委托。然后在您的主应用程序中,您可以继承该自定义 UIViewController 并调用父 API 来加载UIDocumentPickerViewController
。
推荐阅读
- database - Power BI - TopN + Others 来自两个表的数据
- c# - 如何在 Common Data Service 上创建自定义行业加速器?
- oracle - 在 Spring Boot 实体中管理 String id 序列
- c# - 获取实例 someClass
给出错误'...是一个变量,但用作类型' - r - 有没有办法让 R 知道如何查看日期时间?
- ios - 带有firebasex插件的Ionic 3 iOS构建错误-找不到模块'FirebaseFirestore'
- pygame - 如何让玩家看起来像在树的后面?
- python-3.x - 无法在 heroku 上部署 GIT php/python3 项目 <-> AWS
- arrays - 如何在 Google 表格中获取与 QUERY 相结合的 ARRAY 公式的来源
- c++ - Windows 7 上的 Windows shell 和 Git bash shell 的执行时间差异