UIDocumentInteractionController操作/选项菜单在首次启动时不可见

时间:2017-03-02 07:02:13

标签: ios iphone swift uinavigationcontroller uidocumentinteraction

操作/选项菜单在第一次启动时不可见,当我进入全屏模式并返回正常模式时会出现。附上截图供参考。我究竟做错了什么?这是代码:

let docController = UIDocumentInteractionController(url: url!)
docController.delegate = self
docController.presentPreview(animated: true)

和委托方法:

override func documentInteractionControllerViewControllerForPreview(_ controller: UIDocumentInteractionController) -> UIViewController {
        return self.navigationController!
}

有没有办法可以将底栏颜色(包含动作/选项菜单按钮)更改为黑色?Without menu icon first launch With menu icon after full screen mode

2 个答案:

答案 0 :(得分:0)

试试这个,它对我有用

let docPrev:UIDocumentInteractionController = UIDocumentInteractionController.init(url: url!)
docPrev.delegate = self
docPrev.presentPreview(animated: true)

委托方法:

func documentInteractionControllerViewControllerForPreview(_ controller: UIDocumentInteractionController) -> UIViewController {
    return self
}

答案 1 :(得分:0)

请访问以下链接: Opening a file by UIDocumentInteractionController

上述链接的答案表明,在委托方法中,您需要返回“自我”。这与Jigar提到的相同。以上链接建议如下链接可能对您有所帮助

https://developer.apple.com/library/content/documentation/FileManagement/Conceptual/DocumentInteraction_TopicsForIOS/Articles/PreviewingandOpeningItems.html