I'm using Apple's "Page-Based Application" Xcode template and this rendering approach.
I'm rendering each PDF page into it's own PDFPageView via drawRect, then adding it as subview to a DataViewController for each page.
This is working, but since the rendering of the page takes some time, it delays the page flicking-animation, so I'm wondering how to prerender and cache the pages.
So far, I am putting the DataViewControllers into a mutable dictionary after the page has rendered. Subsequent calls to viewControllerAtIndex for that index are indeed quicker, but if I keep flicking through pages in a longer (52 pages, 11MB) PDF file to the last page, and flick back, things get slower again after 10 pages, although the DataViewControllers already exist in the dictionary.
Is this the right approach, or should I cache the rendered PDFPageViews instead?
When I want to prerender in advance, should I use dispatch_async to render, and put the pre rendered PDFPageView or DataViewController into the dictionary?
Or should I use a completely different approach altogether? Thanks!