Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to sync scroll with multiple UIScrollViews?

I have 2 UIScrollViews displaying an image each (overview and zoom mode). I can scroll in both views already individually, now I want to keep the centerpoint of both views in sync.

I guess when one of the views is creating events, I need to forward them also to the other view, just can't find out which functions are relevant. Any hints?

edit: If parallel live scrolling is not possible, I want to at least sync after a scroll event.

like image 762
Daniel Brown Avatar asked Dec 14 '11 15:12

Daniel Brown


1 Answers

Check out the functions

  • -setContentOffset:animated:
  • -contentOffset
  • -zoomScale
  • -setZoomScale:animated:
  • -zoomToRect:animated:

You can link this together in the delegate method -scrollViewDidScroll:, which is constantly called while the user is scrolling.

like image 52
Richard J. Ross III Avatar answered Sep 21 '22 08:09

Richard J. Ross III