I would like to have one large scrollview with horizontal scroll enabled. Inside this scrollView, I would like to (say) 5 other scrollviews that can be scrolled vertically.
Can someone point me in the right direction how to handle touches?
I am thinking of making two gesturerecognizer (1 for the crane and 1 for panning) and use the delta of the X and Y values to calculate the horizontal or vertical scroll. After I checked the direction, I installed a large scroller or one of the scrollers to turn it on or off. Is it correct?
EDIT: Instead of using my method above, I was just able to add my 5 scrollviews (vertical scroll) to one large scrollview (horizontal), adding 5 scrollviews as a large spy. Perhaps this code can help someone, as well as provide sample code.
for (int i = 0; i < NumberOfVerticalScrollers; i++) {
CGRect frame;
frame.origin.x = self.scrollView.frame.size.width * i;
frame.origin.y = 0;
frame.size = self.scrollView.frame.size;
UIScrollView *scroller = [[UIScrollView alloc] initWithFrame:frame];
scroller.directionalLockEnabled = YES;
scroller.contentSize = CGSizeMake(320, 960);
[self.scrollView addSubview:scroller];
}
self.scrollView.delegate = self;
self.scrollView.contentSize = CGSizeMake(self.scrollView.frame.size.width * NumberOfVerticalScrollers, self.scrollView.frame.size.height);
source
share