ios - 支持 UIDocumentInteractionController 的横向和纵向
问题描述
我的 IOS 应用程序的方向已锁定为纵向模式。但是,我想为使用 UIDocumentInteractionController 打开的文件同时支持横向和纵向。这是我打开文件网址的代码。
let url = URL.init(fileURLWithPath: fileURL)
self.documentController = UIDocumentInteractionController.init(url: url)
documentController!.delegate = self
documentController!.presentPreview(animated: false)
如何为使用上述代码打开的文件实现纵向和横向,同时将其他屏幕的方向锁定为纵向?非常感谢!
解决方案
覆盖supportedInterfaceOrientations 和shouldAutoRotate:
如何只允许单个 UIViewController 在横向和纵向方向上旋转?. Swift 3 犹太版
推荐阅读
- javascript - API响应中的pdf文件为空:Nodejs
- javascript - 如何使用全局变量使用 IF ELSE 语句来反转 JS 动作的效果?
- javascript - 从工作时间中找到可用时间的最佳方法是什么
- c# - ASP.NET Core Razor 使用属性作为发布表单的基础
- python - 避免在列表推导中多次调用同一函数
- vb.net - 如何检测 vb.net 中另一个应用程序的击键?
- python - 如何将字符串变量转换为字典
- javascript - 如何从 addEventListener 中访问“this”?
- sql - SQL Server 查询分析器与执行计划
- javascript - html中的Java脚本数组排序问题,它首先显示最后一个元素