【问题标题】:iOS - Disable UIDocumentInteractionController options buttoniOS - 禁用 UIDocumentInteractionController 选项按钮
【发布时间】:2011-11-03 22:59:17
【问题描述】:
快速提问。有谁知道是否有一种方法可以禁止 UIDocumentInteractionController 显示菜单以在不同的应用程序中打开文档? (右上角的按钮)或者至少隐藏那个按钮?我想我记得看到你可以在某个地方做到这一点......
即。有docController.menuButton.hidden = YES 之类的吗?
谢谢。
【问题讨论】:
标签:
iphone
objective-c
ios
ipad
【解决方案1】:
我认为您需要查看 Quick Look 控制器,而不是 UIDocumentInteractionController。
【解决方案2】:
这不是微不足道的,可能会随着每次 iOS 更新而中断。
首先,您需要获取由UIDocumentInteractionController 创建的底层QLPreviewController。
为此实现UIDocumentInteractionControllerDelegate的documentInteractionControllerWillBeginPreview:
public func documentInteractionControllerWillBeginPreview(_ controller: UIDocumentInteractionController)
{
DispatchQueue.main.async { // Use async or you won't get anything
let aQLPreviewController = self.documentInteractionControllerViewControllerForPreview(controller).presentedViewController
// Next dig the QLPreviewController hierarchy
}
}
现在您已经有了底层QLPreviewController,请按照此答案https://stackoverflow.com/a/69454052/1049134 中的说明进行操作