I want to put a second UIScrollView inside of the first page of another UIScrollView. To scroll to page 2 of the first UIScrollView I now have to swipe right above oder below the second UIScrollView. Is there a way to ignore a right swipe while being on page 3 of the second UIScrollView so I can scroll to page 2 of the first UIScrollView? Hope you understand my problem :/
There are different approaches.
You could implement the delegate methods of the scroll view (void)scrollViewDidScroll:(UIScrollView *)sender
and (void)scrollViewDidEndDecelerating:(UIScrollView *)sender
to observe when the view was scrolled.
Through this you can track the index of the current page of the second scrollview.
I haven't tried it out yet, but something like this should go into the right direction:
- (void)scrollViewDidScroll:(UIScrollView *)sender
{
if (indexOfSecondScrollView == 3 && secondScrollView.contentOffSet.x >= 3*second_scroll_view_screen_width){
firstScrollView.scrollEnabled == YES;
//move firstScrollView doing something like this:
[self.scrollView scrollRectToVisible:CGRectMake(x,y,width,height) animated:YES];
}
else{
firstScrollView.scrollEnabled = NO;
}
}