It is really easy. As your friend suggested, you will need at least 2 UIScrollView . For horizontal (i.e. Paging) you will need a UIScrollView , and you will need one UIScrollView for each page. The key points are (call them scrollHorizontal and scrollVertical ):
scrollHorizontal.frame.height should equal scrollHorizontal.contentSize.height (otherwise you will scrollHorizontal.contentSize.height into vertical paging)scrollVertical : first, you will have one of them for each page. The frame width and contentSize.width should match and it makes sense to wrt the page width (in your scrollHorizontal ). Of course, you should have a frame height of no more than scrollHorizontal.contentSize.height .
Code example:
UIScrollView scrollHorizontal = [[UIScrollView alloc] initWithFrame: CGRectMake (0, 0, self.view.bounds.size.width, self.view.bounds.size.height)];
scrollHorizontal.pagingEnabled = YES;
scrollHorizontal.directionalLockEnabled = YES; // not needed but helpful
// Now let create each page
UIScrollView * scrollPage1 = [[UIScrollView alloc] initWithFrame: CGRectMake (0, 0, self.view.bounds.size.width, self.view.bounds.size.height)];
[scrollPage1 addSubview: theContentViewForPage1];
scrollPage1.contentSize = CGSizeMake (self.view.bounds.size.width, theContentViewForPage1.bounds.size.height);
// Add page to scrollHorizontal
[scrollHorizontal addSubview: scrollPage1];
[scrollPage1 release];
//...add more pages (REMEMBER to set the scroll view frame.origin.x accordingly for each additional page)
// Set the scrollHoriztonal content size
scrollView.contentSize = CGSizeMake (self.view.bounds.size.width * NUMBER_OF_PAGES, self.view.bounds.size.height);
// Now add the scrollview to self.view; or even self.view = scrollHorizontal, etc.
source share