首页 > 解决方案 > 支持 UIDocumentInteractionController 的横向和纵向

问题描述

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

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

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

标签: iosswiftuidocumentinteractioncontroller

解决方案


覆盖supportedInterfaceOrientations 和shouldAutoRotate:

如何只允许单个 UIViewController 在横向和纵向方向上旋转?. Swift 3 犹太版


推荐阅读