0
votes

I've a problem with the ScrollViews in Titanium in an iOS-app: I added two ScrollViews to my basic-window so that they are shown on start up. Both ScrollViews contain an ImageView and have exactly the same size. Thanks to the ScrollView you can scroll through the images given with the ImageViews. What I now want is the following:

When I scroll in the first ScrollView I want that the second ScrollView scrolls exactly the same way; I'm scrolling in one view and the content of the second ScrollView changes the same way too.

To solve this problem I tried the following:

firstScrollView.addEventListener('scroll', function(e) {
    secondScrollView.scrollTo(e.x, e.y);
});

When the first ScrollView fires the "Scroll"-event I tell the second ScrollView the position of it. In principle this works fine, but the animation of the second ScrollView is always delayed and I need this animation simultaneously to the first ScrollView.

Am I doing something wrong? Or is there another method to solve this problem?

Thanks and best regards, Thomas

1

1 Answers

0
votes

This callback function wont trigger until after the physical scroll happens because the event isn't fired until the scroll occurs. Naturally, there is a delay on the animation to begin with, depending on the speed of the device and the size of the view. What you might want to do is use a different event, maybe swipe depending on the nature of your app.