Author Topic: Synchronise UIScrollViews  (Read 2340 times)

mimminito

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
Synchronise UIScrollViews
« on: February 11, 2014, 06:49:11 AM »
Hi,

I would like to synchronise two UIScrollViews, so that when one is changed, the other is updated by the correct amount. They will both have the same amount of items inside of them.
To give you an overview of what I am trying to do, I am building a timeline style view, where one ScrollView contains the content, and the other is the "scrubbable" timeline. Ideally, when the user is scrubbing the timeline ScrollView, I would like the content ScrollView to move accurately along with it. I cannot use a UIProgressBar as the timeline could be very long, and needs to be longer than the visible panel.

Any ideas/help is much appreciated.

Adam

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Synchronise UIScrollViews
« Reply #1 on: February 11, 2014, 08:09:43 PM »
UIScrollView.SetDragAmount lets you change the position of the scroll view. This is also what the scroll view's scroll bars use.

mimminito

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
Re: Synchronise UIScrollViews
« Reply #2 on: March 20, 2014, 05:55:23 AM »
Ok, so I got this working with two ScrollViews in 3D. But now I have a ScrollView in 2D and a ScrollView in 3D. When using the SetDragAmount as I had previously, its not working any more. The drag for one is far greater than the other, and therefore not working correctly. Any help would be appreciated here as to how I could sync up 3D and 2D ScrollViews.

mimminito

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
Re: Synchronise UIScrollViews
« Reply #3 on: March 20, 2014, 06:51:33 AM »
Ive got it working by linking a single Scroll Bar to both Scroll View's, and it seems to be working fine.