【问题标题】:iOS: Is it possible to customize the "Open in..." menu when previewing a document?iOS:预览文档时是否可以自定义“打开方式...”菜单?
【发布时间】:2010-12-06 20:43:25
【问题描述】:

我希望利用UIDocumentInteractionControllerQLPreviewController 在我的应用程序中预览PDF 和图像。我想知道是否可以进行以下任何自定义(我已经搜索了文档但没有任何运气)。

  • 完全删除“打开方式...”菜单(例如,用户可以预览图像但不能将其导出到其他应用程序)

  • 让“打开方式...”菜单打开一个文件,而不是正在预览的文件(例如,预览是 PDF 文档,但“打开方式...”菜单实际上会导出 ePub 文件)

UIDocumentInteractionControllerDelegate 有一个方法 documentInteractionController:canPerformAction: 看起来与我正在寻找的类似,但文档表明 copy:print: 是唯一受支持的选择器。

(同样,不太重要,但是否可以修改UIDocumentInteractionControllerQLPreviewControllerUIModalTransitionStyleUIModalPresentationStyle?因为QLPreviewControllerUIViewController 的子类,我想我' 将能够设置 modalTransitionStyle 和 modalPresentationStyle 属性,但这并没有产生预期的结果。)

【问题讨论】:

    标签: iphone cocoa-touch ios uiviewcontroller modalviewcontroller


    【解决方案1】:

    这已被问过几次,似乎不允许进行太多自定义。但是,似乎可以将额外的 UIBarButtonItem 添加到 UIDocumentInteractionController (下面的第二个链接)。至于自定义转换,如果您尝试过 modalTransitionStyle 和 modalPresentation 样式,那么我假设您不能。我找不到任何关于它的信息,但我可能总是错的。

    Can I hide the Action button on the UIDocumentInteractionController view?

    Custom "Email" action in UIDocumentInteractionController

    UIDocumentInteractionController adding custom actions to menu (eg email, save to photos)

    【讨论】:

      【解决方案2】:

      通过将 QLPrevieController 显示为子控制器,我实现了我想要的自定义级别,能够随意更改父控制器。

      [self addChildViewController:self.previewController];
      

      【讨论】:

        猜你喜欢
        • 2012-04-26
        • 1970-01-01
        • 2011-01-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多