TheChes44
TheChes44

Reputation: 656

Adding Multiple web pages to UIWebview in a Page-Based app

I am working on making a paged app that will load a separate HTML page on each page. I am using the already given example that Apple has provided and rigged it to make the label dissapear and a few other things. Most tutorials I have seen do not cover this idea at all.

I need to be able to make an array of webpages and using one UIWebview display those pages, obviously one HTML file per page. What will be the most efficient way to do this that is up to date with iOS5 or is there a recent tutorial I can follow? Thanks.

Upvotes: 3

Views: 1911

Answers (1)

Mundi
Mundi

Reputation: 80265

Depending on how much data you have you could serialize the HTML data in a single file (such as a plist) or have them as separate files in a directory.

Based on the template you are using, you would

  • change the view in DataViewController to a UIWebView;
  • then override the viewControllerAtIndex method in your ModelController and pass the path to your HTML page as the data object;
  • and finally load the HTML in the viewWillAppear method of your DataViewController.

Voilà, here is your tutorial!

Upvotes: 1

Related Questions