如何禁用QLPreviewController打印按钮 [英] How to Disable QLPreviewController print Button

查看:507
本文介绍了如何禁用QLPreviewController打印按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁能告诉我如何删除QLPreviewController打印按钮?也想禁用剪切/粘贴/复制。

Can anyone tell me how to remove the QLPreviewController print button? Also would like to disable cut/paste/copy.

推荐答案

更新:

这在iOS 6中不再有效。快速查看使用XPC在另一个进程中运行。有关详细信息,请参见[此处] [3]。我没有预见到任何自定义QLPreviewController的方法。以下答案仍适用于对iOS 6之前感兴趣的任何人。

This no longer works in iOS 6. Quick Look runs in another process using XPC. See [here][3] for more details. I don't foresee any way to customize QLPreviewController. The following answer remains for anyone interested for pre-iOS 6.

如果您只想删除所需的操作按钮子类 QLPreviewController 。然后在 -viewWillAppear:中你需要通过调用 [[self navigationItem] setRightBarButtonItem:nil]删除操作按钮; 这也将删除与其他应用共享文件的功能。如果您对这种损失感到满意,那么这是最简单的解决方案。需要注意的一点是 QLPreviewController 不是要自定义的。您可以在Github上查看此存储库。它包含一个已经安全子类化的QLPreviewController。您只需添加一行即可删除操作按钮。回购还有其他一些便利。

If you want to simply remove the action button you need to subclass QLPreviewController. Then in -viewWillAppear: you need to remove the action button by calling [[self navigationItem] setRightBarButtonItem:nil]; This will also remove the ability to share files with other apps. If you are fine with that loss, then that's the easiest solution. One thing to be aware of is that QLPreviewController is NOT intended to be customized. You can check out this repository on Github. It contains a QLPreviewController that is already safely subclassed. You just need to add the one line to remove the action button. The repo also has some other conveniences.

更好但更复杂的解决方案是使用 UIDocumentInteractionController 。根据我对 QLPreviewController 的理解,它是使用 UIDocumentInteractionController 构建的。 QLPreviewController 是为了一般用途和简单添加而制作的。 UIDocumentInteractionController 提供更多控制权,但更难使用。我不能在这里充分描述如何使用它。我建议您查看WWDC 2010会话106了解文档交互控制器。

The better but more complicated solution is to use UIDocumentInteractionController. From what I understand of QLPreviewController is that it's built using UIDocumentInteractionController. QLPreviewController was made for general use and easy addition. UIDocumentInteractionController gives much more control, but is harder to use. I can't sufficiently describe how to use it here. I recommend checking out WWDC 2010 session 106 Understanding Document Interaction Controller.

至于禁用剪切/复制/粘贴,你不能用 QLPreviewController 来做到这一点。你可以用 UIDocumentInteractionController 来做到这一点,但我不会指望它。根据您要显示的文件,您可以执行完全自定义的实现,但这是很多工作。为纯文本,照片,视频和PDF制作观众相对容易。 Office文档比它的价值更多。

As for disabling cut/copy/paste, you can't do that with QLPreviewController. You might be able to do that with UIDocumentInteractionController, but I wouldn't count on it. Depending on what files you want to display, you may be able to do a completely custom implementation, but that's a lot of work. It's relatively easy to make viewers for plain text, photos, videos, and PDFs. Office documents are more effort than it's worth.

编辑:

我已经建立了删除操作按钮的功能直接进入 RBFilePreviewer 所以你不必担心自己这样做。

I've built the ability to remove the action button right into RBFilePreviewer so you don't have to worry about doing it yourself.

这篇关于如何禁用QLPreviewController打印按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆