Keep track of the currently dragging scroll view when scrollViewWillBeginDragging: is called.
In scrollViewDidScroll:
, update the scroll view that is not dragging:
- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
if(scrollView == self.mainCollectionView
&& self.mainCollectionView == self.scrollingView){ // new check
CGFloat x = self.mainCollectionView.contentOffset.x / self.mainCollectionView.bounds.size.width * SM_IPHONE_THUMB_CONTAINER_SIZE; // cell width + spacing 48 + 8
CGFloat y = 0;
CGPoint contentOffset = CGPointMake(x, y);
self.thumbsCollectionView.contentOffset = contentOffset;
}
else if(scrollView == self.thumbsCollectionView
&& self.thumbsCollectionView== self.scrollingView){ // new check
CGFloat x = self.thumbsCollectionView.contentOffset.x / self.thumbsCollectionView.bounds.size.width * SM_IPHONE_THUMB_CONTAINER_SIZE; // cell width + spacing 48 + 8
CGFloat y = 0;
CGPoint contentOffset = CGPointMake(x, y);
self.mainCollectionView.contentOffset = contentOffset;
}