1. Create a project to run the following app.js.
2. Hit the button then try to move the scrollable contents horizontally.
3. Hit the button again then try to move the scrollable contents horizontally.
Expected results: After resize the scrollView's width/height and its contentWidth/contentHeight, the scroll view should get updated immediately.
Actual results: After resizing, the scroll view is not updated until the view is refreshed(happened when the button is hit again).
var win = Titanium.UI.createWindow({
layout:'vertical',
backgroundColor:'#fff'
});
var scrollView = Ti.UI.createScrollView({
showHorizontalScrollIndicator:true, showVerticalScrollIndicator:true,
width: 250, height: 100, top: 50,
borderColor:'green', borderWidth:1,
contentWidth:1000, contentHeight:100
});
for(var i=0; i<10; i++) {
for(var j=0; j<10; j++) {
scrollView.add(Ti.UI.createLabel({
top:i*100, left:j*100,
width:100, height:100,
text:i+':'+j, textAlign:'center',
color:'white',
backgroundColor:'#A0' + Number(i%2*8).toString(16) +'0'+ Number(8-j%2*8).toString(16)+'0',
borderColor:'black', borderWidth:1
}));
}
}
var button = Ti.UI.createButton({title:'Flip', width:100, height:50});
button.addEventListener('click', function() {
scrollView.width = 100;
scrollView.height = 250;
scrollView.contentWidth = 100;
scrollView.contentHeight = 1000;
button.title = 'Click again';
});
scrollView.addEventListener('scroll', function() {
Ti.API.info('Offset: (' + scrollView.contentOffset.x + ', ' + scrollView.contentOffset.y + ')');
});
win.add(scrollView);
win.add(button);
win.open()
What is the scrollable property?
Sorry Don. I mean the view should get updated immediately.
I verified that this is indeed broken as specified. Scheduling for 1.8 fix.
Pull request pending #658
Tested on Ti Studio 1.0.7.201112061404 Ti Mob SDK 1.8.0.1.v20111207091653 OSX Lion iPhone 4S OS 5.0.1 Expected behavior is shown where the scroll view is updated immediately
Open to add label