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 window.open().
2. Also, only call the method after you added ScrollView to the Window

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


No comments:

Post a Comment

Oracle - Reclaim disk space

Oracle does not release disk space even if you had delete the data or tablespace. If you have enterprise manager, you should use it to  rec...