Here\'s a tricky iPhone problem I\'ve been working on. I have three UIScrollViews on a page, one that only scrolls horizontally, one that only scrolls vertically, and one th
I think the simplest way would be to add a delegate to your scrollviews which implement the following method:
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
Then you can check the contentOffset to check by how much the scrollview did actually scroll, and update the main scrollview accordingly.
You need to extend UIScrollView for all three uses on your screen and override the touchesMoved:withEvent: methods to call the other ones (make sure you don't end up with circular code that ends up calling itself again!).
So, for example the code in the two-way scrolling item could be based on this:
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
[horizontalScrollview touchesMoved:touches withEvent:event];
[verticalScrollview touchesMoved:touches withEvent:event];
}
by using some additional variable (eg ControllerLastTouched
) you can check that before calling the other two touchesMoved:withEvent: methods.
This should enable you to do the "cloning" you were talking about...