3

I'm developing an iOS 4 application with iOS 5.0 SDK and XCode 4.2.

I have to make a slider showing web pages (5 or more). I've thought to add only one UIWebView and when user swipes left, I load another page. Maybe I can add a PageControl to show how many pages are.

My problem is how to handle swipe left event, and if there is a way to preload the next web page before it shows. In other words, if I have three pages and now I'm showing page one, I would like to preload page two. And, when user swipes left, and he see pages two I would like to preload page three.

Any clue?

Or

Do you know a better approach to make a web pages gallery?

I have tried to make a html slider, but it doesn't work because it gets a lot time to load html page. Here is a question related to it: Unsorted list: load images or divs on demand

Community
  • 1
  • 1
VansFannel
  • 45,055
  • 107
  • 359
  • 626

1 Answers1

1

I think the easiest approach is to make a UIScrollView with horizontal scrolling, and paging enabled. Then you can put in every page of the scroll a webview, and using the delegate:

- (void)scrollViewDidScroll:(UIScrollView *)scrollView

You can start loading the webs when the user starts to scroll!

Antonio MG
  • 20,382
  • 3
  • 43
  • 62
  • Sorry, I don't know if I'm doing it well. I have set delegate to UIWebView.scrollView, and it doesn't detect swipe left. – VansFannel Mar 22 '12 at 10:01
  • You have to create a scrollView, then put the webviews inside, and then do: scrollView.delegate = self; – Antonio MG Mar 22 '12 at 10:03