使用Quicklook Framework(QLPreviewController)拦截PDF链接点击 [英] Intercepting PDF Link Clicks using Quicklook Framework (QLPreviewController)

查看:163
本文介绍了使用Quicklook Framework(QLPreviewController)拦截PDF链接点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Quicklook中是否可以使用PDF链接处理?

Is PDF Link handling available in Quicklook?

我创建了一个原型,并且QLPreviewControllerDelegate方法-(BOOL)previewController:(QLPreviewController *)控制器应该OpenURL:(NSURL *)forPreviewItem:{id)项目的URL永远不会被调用.

I created a prototype, and the QLPreviewControllerDelegate method -(BOOL)previewController:(QLPreviewController *)controller shouldOpenURL:(NSURL *)url forPreviewItem:(id)item never gets called.

当我使用带有链接的.docx文件时,会触发委托方法.

When I use a .docx file with links in it, the delegate method does get fired.

此外,当我使用野生动物园或UIWebView打开PDF时,链接处理效果很好.

Also, when I open up the PDF using safari, or a UIWebView, link handling works fine.

我用一些不同的PDF进行了测试,并且链接拦截从未成功.

I tested with a few different PDFs, and link interception never worked.

我确保我的界面"实现了以下协议: QLPreviewControllerDataSource,QLPreviewControllerDelegate

I made sure that My interface implements the following protocols: QLPreviewControllerDataSource, QLPreviewControllerDelegate

我还确保将具有shouldOpenUrl方法的类分配为我的QlPreviewController实例的委托.

I also made sure that the class that has the shouldOpenUrl method is assigned as the delegate to my QlPreviewController instance.

我猜我的代码不存在问题,因为.docx链接拦截工作正常.

I am guessing the issue is not with my code, since the .docx link interception works fine.

对我可能做错的事情有任何想法吗?

Any thoughts on what I might be doing wrong?

Quicklook是否还支持PDF Link拦截?

Is PDF Link interception even supported by Quicklook?

我还注意到,当我在iOS邮件中打开PDF时,它使用的是Quicklook,PDf链接也无法正常工作.

I also noticed that when I open up a PDF in iOS mail, it uses Quicklook, and PDf links don't work there either.

推荐答案

为那些在这里寻找相同答案的人回答我自己的问题. Quicklook不支持链接处理.如果需要处理PDF文档中的链接,则必须使用CATiledLayer呈现PDF.

Answering my own question for those that land here looking for the same answer. Quicklook does NOT support link handling. You'll have to use CATiledLayer to render PDFs if you need to handle links in PDF documents.

这篇关于使用Quicklook Framework(QLPreviewController)拦截PDF链接点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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