我们如何在不使用 UIWebView 的情况下实现 iPad 的 PDF 阅读器?它需要添加手势的选项,以便通过手触摸来更改页面。我怎样才能做到这一点?为此需要实现哪些类。
更新:
我得到了类似 PDF 文档的 Quartz 2D 编程指南之类的东西。但我无法确定应该将 PDF 的上下文放在哪里。我应该将它放在 UIView
中吗?
请参阅:http://developer.apple.com/iphone/library/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_pdf/dq_pdf.html#//apple_ref/doc/uid/TP30001066-CH214-TPXREF109
How can we implement a PDF reader for iPad without using UIWebView
? It needs the option for adding gestures for changing the page with a hand touch. How does I can do that? What are the classes that need to be implemented for the purpose.
Update:
I got something like Quartz 2D programming guide for PDF Documents. But I can not identify where should i place the context of the PDF. Should i place it in a UIView
?
Refer : http://developer.apple.com/iphone/library/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_pdf/dq_pdf.html#//apple_ref/doc/uid/TP30001066-CH214-TPXREF109
发布评论
评论(2)
CGPDFDocument 由一系列页面组成。如果您使用 CGPDFPageRef 成员创建自定义 UIView,则可以使用它来绘制页面。
这是构建 pdf 阅读器的基本构建块。您可以让视图拥有整个文档而不是一页,但绘图是按页完成的。我通常让一些控制器类拥有文档并将页面分配给视图。
对于手势,将 UISwipeGestureRecognizer 或其他手势识别器添加到视图中。
A CGPDFDocument consists of a series of pages. If you create a custom UIView with a CGPDFPageRef member, you can use it to draw the page.
That is the basic building block from which you build a pdf reader. You could have the view own the whole document instead of just one page, but the drawing is done per page. I generally let some controller class own the document and assign pages to views.
For gestures, add a UISwipeGestureRecognizer or other gesture recognizer to the view.
阅读《Quartz 2D 编程指南》,并在 XCode 文档中搜索 CGPDF... 函数。
Read "Quartz 2D Programming Guide", and search CGPDF... functions in XCode document.