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

iOS: TableView poor performance due to relayouts

    Details

      Description

      Problem description
      There is a lot of unnecessary relayouts when using complex rows with labels and images, leading to poor performance.

      Test case

      var win = Ti.UI.createWindow({});
      var table = Ti.UI.createTableView({});
      win.add(table);
      win.addEventListener("open", function() {
      	var data = [];
       
      	for ( i = 0; i < 10; i++) {
      		(function(i) {
      			var row = Ti.UI.createTableViewRow({
      				width : 320,
      				height : 200
      			});
      			row.addEventListener("postlayout", function() {
      				Ti.API.info("row:" + i)
      			});
       
      			var bimg = Ti.UI.createImageView({
      				image : 'http://overtheair.org/blog/wp-content/uploads/2011/09/appcelerator-logo.png',
      				top : 25,
      				left : 0,
      				right : 0,
      				bottom : 5
      			});
      			bimg.addEventListener("postlayout", function() {
      				Ti.API.info("bimg:" + i)
      			});
       
      			var simg = Ti.UI.createImageView({
      				image : 'http://overtheair.org/blog/wp-content/uploads/2011/09/appcelerator-logo.png',
      				top : 25,
      				left : 5,
      				width : 30,
      				height : 30
      			});
      			simg.addEventListener("postlayout", function() {
      				Ti.API.info("simg:" + i)
      			});
       
      			var bview = Ti.UI.createView({
      				top : 0,
      				left : 0,
      				width : 100,
      				height : 20
      			});
      			bview.addEventListener("postlayout", function() {
      				Ti.API.info("bview:" + i)
      			});
       
      			var label = Ti.UI.createLabel({
      				text : "row:" + i,
      				top : 5,
      				left : 5,
      				right : 5,
      				bottom : 5,
      				height : Ti.UI.SIZE
      			});
      			label.addEventListener("postlayout", function() {
      				Ti.API.info("label:" + i)
      			});
       
      			row.add(bimg);
      			row.add(simg);
      			bview.add(label);
      			row.add(bview);
       
      			row.className = "testrow";
      			data.push(row);
      		})(i);
      	}
      	table.setData(data);
      })
       
      win.open();
      

        Attachments

          Activity

            People

            • Assignee:
              jithinv@exalture.com jithinpv
              Reporter:
              pilo erez pilosof
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

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

                  Git Source Code