Question

I have a simple problem but I can't figure it out. I have a UIScrollView with three nested UIWebViews. I need to be able to "recycle" these views to actually scroll through lots of content.

My main problem is that I can't figure out how to show a view that isn't the very first, meaning that you can immediately swipe back from. Right now I have three views paging, but it starts at the first one, and you can move right two.

What can I do to make it so that I am always in the middle? With the ability to always swipe right OR left?

Thanks!

Was it helpful?

Solution

In the viewDidLoad or viewWillAppear methods for your viewController, try adding the following bit of code:

[self.myMainScrollView setContentOffset:CGPointMake(0,self.view.frame.size.width) animated:NO];

That'll scroll your larger scrollview over, so that the middle UIWebView is visible.

If that doesn't help, dig around in the UIScrollView and UIScrollViewDelegate documentation - you should find some good stuff there.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top