ios - UIDocumentInteractionController 支持横向和纵向

标签 ios swift uidocumentinteractioncontroller

我的 IOS 应用程序的方向已锁定为纵向模式。但是,我想支持使用 UIDocumentInteractionController 打开的文件的横向和纵向。 这是我打开文件 url 的代码。

 let url = URL.init(fileURLWithPath: fileURL)
        self.documentController = UIDocumentInteractionController.init(url: url)
        documentController!.delegate = self
        documentController!.presentPreview(animated: false)

如何实现使用上述代码打开的文件的纵向和横向方向,同时将其他屏幕的方向锁定为纵向? 非常感谢!

最佳答案

覆盖supportedInterfaceOrientations和shouldAutoRotate:

How to allow only single UIViewController to rotate in both Landscape and Portrait direction? 。 Swift 3 犹太版本

关于ios - UIDocumentInteractionController 支持横向和纵向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54556831/

相关文章:

ios - 如何在多个ViewController中使用NSFetchedResultsControllerDelegate而不重复 Controller 代码?

swift - Swift 包的自定义文件夹结构

ios - 使用 UIPageViewController 将 PageCurl 转换为滚动

ios - 与 UIDocumentInteractionController 共享文档

iphone - iPhone 中的 CST 时区从 11 月 3 日起增加一天吗?

ios - 在 iOS 模拟器上以 Release模式 Flutter 启动应用程序时出现问题

ios - React Native 0.26 在显示 Assets 库中的图像时找不到合适的图像 URL 加载器

iOS 应用元数据被拒绝?有什么要检查 ViewDidLoad 的吗?