I see two UIScrollViews, they are on top of each other.
UIView
|
--------------------------
| |
UIScrollView1 UIScrollView2
I would like it to work as follows. If I scroll UIScrollView2, UIScrollView1 should also scroll with the same contentOffset. This must be done synchronously, so use is scrollViewDidScrollnot an option. Do you have an idea how to do this?
Source
_prContentGridView = [[PRContentGridView alloc] initWithFrame:frame];
_prContentGridView.minimumZoomScale = 0.25;
_prContentGridView.maximumZoomScale = 2.0;
_prContentGridView.delegate = self;
_prBackgroundGridView = [[PRBackgroundGridView alloc] initWithFrame:frame];
[self addSubview:_prBackgroundGridView];
[self addSubview:_prContentGridView];
Delegation method
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
if (_prContentGridView.scrollEnabled == YES) {
CGPoint p = CGPointMake(scrollView.contentOffset.x - _prevousContentOffsetOfContentScrollView.x, scrollView.contentOffset.y - _prevousContentOffsetOfContentScrollView.y);
[_prBackgroundGridView setContentOffset:p animated:YES];
}
}
source
share