Thursday, May 24, 2012

Appcelerator - ScrollView setContentOffset Animated: false issue

ScrollView is a very nice UI component in Appcelerator that will handle pinch zoom and drag move their content view. By default the content view are at X = 0, Y = 0 location. What if I want to default the content views to center it?

You could use toScroll or setContentOffset to move the inner content view. Both of these method invoke an animation. How about moving the inner view without animation?

The only choice is setContentOffset with animated: false. For example

scrollview.setContentOffset({x: 200, y: 100}, { animated: false });

Now, if you tried this method and does not work for you. The following may help

1. Make sure you call this method after
2. Also, only call the method after you added ScrollView to the Window

var win = Titanium.UI.createWindow();
var scrollview = = Ti.UI.createScrollView();
scrollview.setContentOffset({x: 200, y: 100}, { animated: false });

No comments:

Post a Comment

PuTTY - Keeping session alive

If you have some VPN tunnels that timeout based on activity, you could try the following setting if you are using PuTTY 1) Open PuTTY and...