I want to develop an ePub-reader application using UIPageViewController and UIWebView for displaying book pages. So I can make pages from different chapters by perform offset with JavaScript-strings.
The question is how can I implement the UIPageViewControlerDataSource delegate working in rightful way? When I prepare some page for showing I should use UIWebView methods and UIWebView delegate methods which are working only if webView is on the screen yet.
I tried to make underlying webView under pageViewController for making calculus linked with ePub chapters paging but I can’t drag loaded content on the page.
Does anyone know how is it implemented in iBooks or the same apps?
One easy solution could be:
UIPageViewController, make it conform toUIPageViewControllerDataSourceandUIWebViewDelegateprotocols and setselfas datasource in the-viewDidLoadoverrideimplement
pageViewController:viewControllerAfterViewController:andpageViewController:viewControllerBeforeViewController:(UIPageViewControllerDataSource protocol methods) so that they return a newUIViewControllercontaining aUIWebViewdisplaying your data.Of course you have to complete the code stub. You should setup a mechanism to distinguish between viewControllers to be able to return the next and the previous page (i.e. I do it with a UIPageViewController subclass declaring a
pageNumberproperty, but I am sure there are more elegant ways to do it..)