I'm trying to synchronize scrolling in all collection views within a table view (see image link below) :
Example Image : http://postimg.org/image/dduhr89e5/
The sample that I have been able to find explains how you can sync two separate scroll views by identifying each. However I am unsure how to identify each collection view when they are in a table view. There could be 1 or hundreds that all need synchronized.
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
if ([scrollView isEqual: theFirstScrollView])
{
theSecondScrollView.contentOffset =
CGPointMake(theFirstScrollView.contentOffset.x, 0);
}
else
{
theFirstScrollView.contentOffset =
CGPointMake(theSecondScrollView.contentOffset.x, 0);
}
}
Assuming each collection view has its own cell and the collection views are similar widths (or at least you have that part figured out), here is the approach I would use:
1) Make your VC the delegate for all of the collection views.
2) When any of them scrolls, go through the TableViews visibleCells and set the content offset for the cells collectionView. Also, store the content offset in the viewController.
3) Whenever a new cell is dequeued, set the content offset to that last stored value in the VC.