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

cpu overload when using tableViewSection.headerView in new window (iphone simulator)



      {html}<div><p>When I want a tableView with my own custom styled section
      headers, using the tableViewSection.headerView property with a
      custom view opened in a new window, the app causes the cpu usage of
      my (new) macbook pro to increase to 100% indicating some sort of
      infinite loop or whatever when trying to render.</p>
      <p>The weird thing is that exactly the same code which causes this
      issue doesn't cause any problems when I don't use it in a separate
      .js file which is opened in a new window.</p>
      <code class="javascript">var win = Ti.UI.currentWindow;
      var tableView = Ti.UI.createTableView({ data:[] });
      var newData = [];
      var row = Titanium.UI.createTableViewRow({});
      var lbl = Titanium.UI.createLabel({text: 'this is a test', height:'auto', top:10, left:10, right:10, color:'#000'});
      row.className = 'test';
      var section = Titanium.UI.createTableViewSection({});
      var headerViewRows = Titanium.UI.createView({height:30, width:'auto'});
      var headerLabel = Titanium.UI.createLabel({text: 'this is a test header text', height:'auto', top:10, left:10, right:10, color:'#000'});
      section.headerView = headerViewRows; // uncommenting this line will cause the cpu to go wayyy up, not using custom headerview will work as expected
      section.headerTitle = 'test header title';
      tableView.data = newData; // no difference between using data = ... or using setData()</code>
      <p>I also tried every variant of properties I could come up with
      for the headerLabel, and the headerViewRows, all did not change
      anything. The view can be created without any explicitly set
      properties and even without the label added, and no properties for
      the section change anything either.</p>
      <p><strong>Now for the issue:</strong> If you create a new project
      and just use the code above in the 'win1', adding the tableView to
      the win1 object, everything works correctly. But if you would use
      this as a separate file (bug.js), using the 'url' property of a new
      window opened from the win1 (by adding a click event listener to
      the label) like this: app.js (of a newly created default
      <code class=
      "javascript">label1.addEventListener('click', function(e){
      var newWin = Ti.UI.createWindow({ url:'bug.js' });
      <p>... causes the cpu to run to its max and sort of freezes the
      app. (iphone simulator 4)</p>
      <p>Now for some extra weirdness: commenting the line which sets the
      headerView property of the section object will not cause this
      <p>I would really like to know why this happens, what I am doing
      wrong or how to fix this behaviour.</p>
      <p><strong>extra maybe related info:</strong> I also noticed the
      following: When I add a 'touchend' eventListener to the tableView
      and log some line in the event, it will output this line infinitely
      from the moment the window is opened, like it is continuously being
      <p>btw. this is all on the latest 1.4.0 mobilesdk, titanium
      developer 1.2.1, iphone sdk 4.0 (latest 4.0.1 xcode)</p>
      <p><a href=
      link to the post in the community forum (same content)</a></p></div>{html}




            • Assignee:
              rseagraves Reggie Seagraves
              victor Victor
            • Watchers:
              0 Start watching this issue


              • Created:

                Backbone Issue Sync

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

                  Git Integration