I have implemented a PDF reader application in which i want to implement paging. How can I implement this? Please advise me.
A:
I'd use a UIScrollView that is big enough to contain all the pages. Enable paging.
In your UIScrollViewDelegate, when -scrollViewDidScroll: gets called, figure out which pages are currently visible. If a new page comes into sight, add a custom UIView to the scroll view at the right position that uses CGContextDrawPDFPage to draw the PDF page.
Make sure to remove views from the scroll view that scroll out of sight to free up memory.
Thomas Müller
2010-06-17 07:17:59
But i want to use uiwebview for pagging is it possible?
JohnWhite
2010-06-17 07:25:55
I don't know - I haven't had a need to use a UIWebView yet and haven't looked at it. But why? What benefits does a UIWebView give you?
Thomas Müller
2010-06-17 07:42:01
If i am using CGContextDrawPDFPage then i have to convert data in to image and then need to disply.If i am dooing zoom effect then text will strech.IF i will use uiwebview then text will not strech.So plase help me for this problem
JohnWhite
2010-06-17 07:45:24
I guess you'll have to redraw the content when zooming finishes. I haven't done this before, but I guess, in -scrollViewDidEndZooming:withView:atScale:, I'd adjust the contentSize and contentOffset depending on the scale (if zoomScale is 2.0, make the content twice as big, for instance), set the zoomScale back to 1.0, and resize and redraw the contentView.
Thomas Müller
2010-06-17 22:14:37