如何在 iOS 的 Quick Look 工具栏中添加自定义按钮?
我目前正在 iPad 上通过模态视图控制器使用 Quick Look 框架显示 PDF 文件。效果很好。我的问题是,由于我正在显示 PDF 文件,“快速查看”预览会自动添加“打印”按钮。我想做的是将“打印”按钮替换为自定义“电子邮件”按钮。这是可以做的事情吗?起初,我认为这将是一件微不足道的事情,但此时我真的很挣扎。任何帮助将不胜感激。
谢谢,
布雷特
I'm currently displaying a PDF file using the Quick Look framework on an iPad via the Modal View Controller. Works great. My problem is that since I'm displaying a PDF file the Quick Look preview is automatically adding a "Print" button. What I would like to do is replace the "Print" button with a custom "Email" button. Is this something that can be done? At first pass I thought this was going to be a somewhat trivial thing to do but at this point I'm really struggling with it. Any help would be greatly appreciated.
Thanks,
Brett
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由于QLPreviewController是UIViewController的子类,因此您可以利用-[UIViewController setToolbarItems:]来自定义工具栏。
现在,当用户点击工具栏中的“回复”图标时,将调用您的 -emailPDF 实现。
Since QLPreviewController is a subclass of UIViewController, you can take advantage of -[UIViewController setToolbarItems:] to customize the toolbar.
Now when the user taps the "reply" icon in the toolbar, your implementation of -emailPDF will get called.
您可以创建 QLPreviewController 的子类,例如 MyQLPreviewController
然后在 viewWillAppear:(BOOL)animated (重要!!)
you can create a subclass of QLPreviewController like MyQLPreviewController
Then in viewWillAppear:(BOOL)animated (IMPORTANT!!)