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

iOS: scrollView is not updated correctly.

    Details

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

      app.js

      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

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                vduggal Vishal Duggal (Inactive)
                Reporter:
                qgao Qing Gao
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

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

                    Git Integration