Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-11973

iOS: Animating 'top' value of UITableView causes it stop scrolling

    Details

      Description

      Issue

      Not able to longer scroll the tableView all the way to the bottom, when attempt animating the 'top' value of a tableView, causes it the contentView to stop scrolling correctly on iOS.

      Reproducible steps
      • 1. Start the app!
      • 2. Scroll the tableView up/down to make sure that all rows are visible
      • 3. Click on the blue bar (Where it says 'Click me!')
      • 4. Attempt to scroll the tableView all the way to the bottom
      • 5. Click on the blue bar
      • 6. Attempt to scroll the tableView (after it is now in its original state)

      This happens after step 4, and then step 6 will return the table to its original state, where you are still unable to scroll to the bottom.

      Expected

      Scroll tableView as needed

      Actual

      You can scroll the entire tableView, only once, when actually the application is first launched.

      Tested on

      iOS 6 simulator
      iPhone 4 - iOS 6

      Console output

      [WARN] New layout set while view [object TiUITableView] animating: Will relayout after animation.

      Runnable sample

      var platformHeight = Ti.Platform.displayCaps.platformHeight - 20, //status bar
      	platformWidth = Ti.Platform.displayCaps.platformWidth;
       
      var fullsizeContainer = Ti.UI.createAnimation({height: platformHeight, duration: 300}); 
      var halfsizeContainer = Ti.UI.createAnimation({height: platformHeight/2, duration: 300})
       
      var showGreenBar = Ti.UI.createAnimation({top: 60, duration: 300}); 
      var hideGreenBar = Ti.UI.createAnimation({top: 20, duration: 300});
       
      var TABLESTATE = {half: 1, full: 2};
       
      (function() {
      	
      	var appWindow = Ti.UI.createWindow({
      		backgroundColor:'white'
      	});
      	
      	var container = Ti.UI.createView({
      		backgroundColor: 'white',
      		height: platformHeight/2,
      		width: platformWidth,
      		bottom: 0
      	});
      	
      	var blueBar = Ti.UI.createLabel({
      		backgroundColor: 'blue',
      		text: "Click Me!",
      		color: 'white',
      		width: platformWidth,
      		height: 20,
      		top: 0,
      		textAlign: Ti.UI.TEXT_ALIGNMENT_CENTER, 
      		borderColor: 'black' //for aesthetics 
      	});
      	
      	var greenBar = Ti.UI.createView({
      		backgroundColor: 'green',
      		width: platformWidth,
      		height: 40,
      		top: 20
      	});
      	
      	var tableData = [];
       
      	var sectionOne = Ti.UI.createTableViewSection({
      		headerTitle: "Section One"
      	});
      	
      	var sectionTwo = Ti.UI.createTableViewSection({
      		headerTitle: "Section Two"
      	});
      	
      	for(var i = 0; i < 20; i++){
      		
      		var row = Ti.UI.createTableViewRow({
      			title: "Example Row"
      		});
      		
      		if(i%2){
      			sectionOne.add(row);
      		} else {
      			sectionTwo.add(row);
      		}
      	}
      	
      	tableData.push(sectionOne);
      	tableData.push(sectionTwo);
      	
      	var tableView = Ti.UI.createTableView({
      		backgroundColor: 'white',
      		height: Ti.UI.FILL,
      		width: platformWidth,
      		top: 20,
      		data: tableData,
      		borderColor: 'red'
      	});
      	
      	var tableState = TABLESTATE.half;
      	blueBar.addEventListener('click', function(e){
      		
      		if(tableState === TABLESTATE.half){
      			//goes from half --> full
      			container.animate(fullsizeContainer);
      			tableView.animate(showGreenBar);
      			tableState = TABLESTATE.full;
      		} else {
      			//goes from full --> half
      			tableView.animate(hideGreenBar);
      			container.animate(halfsizeContainer);
      			tableState = TABLESTATE.half;	
      		}
      	});
      	
      	
      	container.add(blueBar);
      	container.add(greenBar);
      	container.add(tableView);
      	
      	appWindow.add(container);
      	
      	appWindow.open();
      	
      })();
      

        Attachments

          Activity

            People

            • Assignee:
              ingo Ingo Muschenetz
              Reporter:
              egomez Eduardo Gomez (Inactive)
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-15112
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Source Code