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)

    Details

      Description

      {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>
      <p>bug.js<br></p>
      <pre>
      <code class="javascript">var win = Ti.UI.currentWindow;
      var tableView = Ti.UI.createTableView({ data:[] });
      win.add(tableView);
      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.add(lbl);
      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'});
      headerViewRows.add(headerLabel);
      section.headerView = headerViewRows; // uncommenting this line will cause the cpu to go wayyy up, not using custom headerview will work as expected
      section.add(row);
      section.headerTitle = 'test header title';
      newData.push(section);
      tableView.data = newData; // no difference between using data = ... or using setData()</code>
      </pre>
      <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
      project):</p>
      <pre>
      <code class=
      "javascript">label1.addEventListener('click', function(e){
      var newWin = Ti.UI.createWindow({ url:'bug.js' });
      newWin.open({fullscreen:false});
      });</code>
      </pre>
      <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
      cpu-overload.</p>
      <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
      called.</p>
      <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=
      "http://developer.appcelerator.com/question/49531/why-is-the-cpu-going-crazy-when-using-tableviewsectionheaderview">
      link to the post in the community forum (same content)</a></p></div>{html}

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

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

                  Git Integration