I have several cells in a UITableview, each with their own UIScrollView. When a user scrolls in one of the cells I would like all of the other cells to follow. Is there any way to create this kind of interaction by passing the contentOffset to the other cells?
I’m thinking delegation but so far I can’t get this to work. Any ideas?
This is actually quite easy. Just implement the UIScrollViewDelegate method
scrollViewDidScroll:in your viewController and there you set the contentOffset of all other cells. Make your viewController the delegate of the scrollview in each cell and you are done.EDIT:
you could forward the delegate calls back to the cell, like this:
or an imho better way. Make the viewController a delegate of the cell and in the scrollViewDidScoll method inside the cell you tell the delegate (viewController) that the contentOffset has changed so that the view controller updates the cells.