iPhone/iPad draw pdf like iBooks?

这一生的挚爱 提交于 2020-01-01 18:05:10

问题


Does anyone know how to use core graphics to draw a pdf like in iBooks. I can already draw a pdf page using core graphics but was curious how iBooks shows a lower quality view of each page so it loads fast and then when you stay on a page longer it renders it a full quality. This makes it able to open the pdf without having to make the user wait like most magazine apps you see on ipad. Any ideas would help!


回答1:


Apple have some "ZoomingPDFViewer" sample code:

http://developer.apple.com/library/ios/#samplecode/ZoomingPDFViewer/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010281

I suspect that might give you some good ideas :-)




回答2:


I assume they use multiple layers, the first layer loads the pdf in low resolution and the better resolution is prepared in the background. When ready these layers are swapped.

Have a look at CGPDFDocumentRef and CATiledLayer in the documentation.



来源:https://stackoverflow.com/questions/3810536/iphone-ipad-draw-pdf-like-ibooks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!