One easy solution could be:
- subclass
UIPageViewController
, make it conform toUIPageViewControllerDataSource
andUIWebViewDelegate
protocols and setself
as datasource in the-viewDidLoad
override implement
pageViewController:viewControllerAfterViewController:
andpageViewController:viewControllerBeforeViewController:
(UIPageViewControllerDataSource protocol methods) so that they return a newUIViewController
containing aUIWebView
displaying your data.- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController { UIViewController *vc = [[UIViewController alloc] init]; UIWebView *webview = [[UIWebView alloc] init]; webview.delegate = self; // Here you can call - (void)loadData:(NSData *)data MIMEType:(NSString *)MIMEType textEncodingName:(NSString *)encodingName baseURL:(NSURL *)baseURL // to load your web page as you need vc.view = webview; return vc; }
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 pageNumber
property, but I am sure there are more elegant ways to do it..)