I'm afraid I'm having information overload. I have a Tutorial Page for my iPad app (iOS 5.1). I'm trying to create the tutorial page in such a way that the user can swipe left or right on an image (which shows tutorial information) to move to the previous or next section of the tutorial.
_scrollview = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 768, 704)];
_scrollview.backgroundColor = [UIColor grayColor];
_scrollview.contentSize = CGSizeMake(700, 700);
_scrollview.minimumZoomScale = 1.0;
_scrollview.maximumZoomScale = 1.0;
_scrollview.pagingEnabled = YES;
_imgViews = [NSMutableArray arrayWithCapacity:NUMPICS];
for (int i = 0; i < NUMPICS; i++) {
NSString *imgPath = [NSString stringWithFormat:@"%@/%d.png", [[NSBundle mainBundle] resourcePath], i+1];
UIImage *image = [UIImage imageWithContentsOfFile:imgPath];
UIImageView *imgView = [[UIImageView alloc] initWithImage:image];
imgView.frame = CGRectOffset(imgView.frame, 10, 10);
[_imgViews addObject:imgView];
[_scrollview addSubview:imgView];
}
[_scrollview bringSubviewToFront:[_imgViews objectAtIndex:0]];
UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeNext:)];
swipeLeft.direction = UISwipeGestureRecognizerDirectionLeft;
[_scrollview addGestureRecognizer:swipeLeft];
UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipePrev:)];
swipeRight.direction = UISwipeGestureRecognizerDirectionRight;
[_scrollview addGestureRecognizer:swipeRight];
[self.view addSubview:_scrollview];
_pageview = [[UIPageControl alloc] initWithFrame:CGRectMake(0, 654, 768, 50)];
_pageview.numberOfPages = [_imgViews count];
_pageview.currentPage = 0;
_pageview.backgroundColor = [UIColor grayColor];
_pageview.userInteractionEnabled = NO;
[self.view addSubview:_pageview];
But this obviously doesn't do what I'd like. I can now swipe the page to move the image, but I'd like to swipe the image (which will take up the entire screen and have it sweep to the next image. As a note, this must be done programmatically, not through storyboard of the IB.
What is the best way to accomplish this?
Thank you