Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-5861] iOS: scrollView is not updated correctly.

GitHub Issuen/a
TypeBug
PriorityTrivial
StatusClosed
ResolutionFixed
Resolution Date2012-01-03T12:18:31.000+0000
Affected Version/sRelease 1.7.3, Release 1.8.0
Fix Version/sSprint 2011-44, Release 1.8.0.1
ComponentsiOS
Labelsmodule_scrollview, qe-testadded
ReporterQing Gao
AssigneeVishal Duggal
Created2011-10-25T14:27:38.000+0000
Updated2012-01-25T14:05:19.000+0000

Description

Steps To Reproduce:

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()

Associated Helpdesk Ticket

http://appc.me/c/APP-113112

Comments

  1. Don Thorp 2011-10-25

    What is the scrollable property?
  2. Qing Gao 2011-10-25

    Sorry Don. I mean the view should get updated immediately.
  3. Reggie Seagraves 2011-10-26

    I verified that this is indeed broken as specified. Scheduling for 1.8 fix.
  4. Vishal Duggal 2011-11-09

    Pull request pending #658
  5. Michael Pettiford 2011-12-07

    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
  6. Natalie Huynh 2012-01-03

    Open to add label

JSON Source