是否可以在容器中显示UIDocumentInteractionController?

时间:2016-10-17 13:40:08

标签: ios

我在容器视图中有一个UIViewController。视图控制器在UIDocumentInteractionController中显示PDF,如下所示:

let documentInteractionController = UIDocumentInteractionController(url: pdfUrl)
documentInteractionController.delegate = self
documentInteractionController.presentPreview(animated: true)

UIDocumentInteractionController以模态方式显示。我希望它显示在容器中。这可能吗?

1 个答案:

答案 0 :(得分:0)

对此有点迟了但最近我遇到了同样的问题 - 我不确定您的完整导航设置,但是在下面的委托方法中返回导航控制器将在导航堆栈中显示预览。 (返回任何其他内容将显示默认模态视图)

此处的文档:https://developer.apple.com/reference/uikit/uidocumentinteractioncontrollerdelegate/1616799-documentinteractioncontrollervie

func documentInteractionControllerViewControllerForPreview(_ controller: UIDocumentInteractionController) -> UIViewController {
    //return self to present modally
    //return nav controller to push document preview into the stack
    return self.navigationController!
}