views:

768

answers:

2

Hi All,

I have two scrollers in same view(like 2 vertical scrollers). I want to do something like, when i scroll one scroller the another scroll should also move by the same amount and in same direction as first one.

Is there any way i can achieve this??? Any sample will be really appreciated.

Thanks in Advance.

Vishal.

A: 

You will have to intercept the touches and manually send a scrollTo: message to both scrollviews.

coneybeare
Can you please elaborate on this as i am new to application development or do you know any sample that will help me.Thanks,Vishal.
Vishal Mali
A: 

I think I've done this... I did it like this:

- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
  if ([scrollView isEqual: theFirstScrollView])
  {
      theSecondScrollView.contentOffset =
              CGPointMake(theFirstScrollView.contentOffset.x, 0);
  }
  else
  {
     theFirstScrollView.contentOffset = 
              CGPointMake(theSecondScrollView.contentOffset.x, 0);
  }
}

The scrollviews must share the same delegate, and it handles the behavior in the scrollViewDidScroll method.

luvieere
Hi Luvieere, Thanks for your great herlp. It worked at my side. Yupppppy. Once again Thanks for your time.Ragards,ViShAl.
Vishal Mali