You can't animate an element inside the scrollview when you are using SDK 2.0. You were able to do it in 1.8.2.
1. Create a new mobile app.
2. Paste this code:
var win = Ti.UI.createWindow();
var scrollView = Ti.UI.createScrollView({
contentHeight: 'auto',
contentWidth: 'auto',
layout:'vertical', //Change from default value from absolute to a relative distance between the sibling views
scrollType:"vertical",
top: 0,
showVerticalScrollIndicator: true,
showHorizontalScrollIndicator: false
});
var mapView = Ti.Map.createView({
mapType: Ti.Map.STANDARD_TYPE,
height: 150,
top:0,
animate:true,
regionFit:true,
userLocation:true,
annotations:[]
});
var resizeBtn = Ti.UI.createButton({
title:"resize map",
width:100,
height:44,
right:5,
bottom:5
});
var mapToggle = false;
resizeBtn.addEventListener("click", function(e){
mapToggle = !mapToggle;
if(mapToggle){
mapView.animate({height:250, duration:300});
} else {
mapView.animate({height:150, duration:300});
}
});
mapView.add(resizeBtn);
scrollView.add(mapView);
//other content
var testView = Ti.UI.createView({top:0, height:200, width:300, backgroundColor:"red"});
var resize2Btn = Ti.UI.createButton({
title:"resize view",
width:120,
height:44,
right:5,
bottom:5
});
var toggle = false;
resize2Btn.addEventListener("click", function(e){
toggle = !toggle;
if(toggle){
testView.animate({height:300, duration:300});
} else {
testView.animate({height:200, duration:300});
}
});
testView.add(resize2Btn);
scrollView.add(testView);
//other content
scrollView.add(Ti.UI.createView({top:0, height:200, width:300, backgroundColor:"blue"}));
win.add(scrollView);
win.open();
PR pending https://github.com/appcelerator/titanium_mobile/pull/2079
Closing issue Tested with Ti Studio build 2.1.0.201206172244 Ti Mobile SDK 2.1.0.v20120619142258 hash r5982b78e OSX Lion 10.7.3 iPhone 4S OS 5.1 The expected behavior is shown
Re-opening to edit label