Create Sideways Scrolling View Of Multiple Pages
This could be for a single page ap or as one of the views within say a UITabBarController
//********** LOAD VIEW **********
- (void)loadView
{
//----- CREATE SCROLL VIEW -----
CGRect frame = [[UIScreen mainScreen] applicationFrame];
UIScrollView *sv = [[[UIScrollView alloc]
initWithFrame:frame] autorelease];
//Create Page View
frame.origin.y = 0;
UIView *viewA = [[[UIView alloc]
initWithFrame:frame] autorelease];
[viewA setBackgroundColor:[UIColor yellowColor]];
//Create Page View
frame.origin.x += frame.size.width;
UIView *viewB = [[[UIView alloc]
initWithFrame:frame] autorelease];
[viewB setBackgroundColor:[UIColor blueColor]];
//Add the pages to the scroll view
[sv addSubview:viewA];
[sv addSubview:viewB];
//Make content size wide enough for each page
[sv setContentSize:CGSizeMake(2 * frame.size.width, frame.size.height)]; //- ENSURE THIS IS WIDE ENOUGH FOR EVERY PAGE
[sv setPagingEnabled:YES]; //Make scrolling stop at each page
[self setView:sv];
}