Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-1469] cpu overload when using tableViewSection.headerView in new window (iphone simulator)

GitHub Issuen/a
Resolution Date2011-04-15T02:53:43.000+0000
Affected Version/sn/a
Fix Version/sn/a
Labelscreatetableviewsection, headerview, ios, simulator
AssigneeReggie Seagraves


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.

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.


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

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.

Now for the issue: 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):

label1.addEventListener('click', function(e){
    var newWin = Ti.UI.createWindow({

... causes the cpu to run to its max and sort of freezes the app. (iphone simulator 4)

Now for some extra weirdness: commenting the line which sets the headerView property of the section object will not cause this cpu-overload.

I would really like to know why this happens, what I am doing wrong or how to fix this behaviour.

extra maybe related info: 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.

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)

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)


  1. Victor 2011-04-15

    has anyone seen this issue? It would be nice to know what I might try as a workaround...
    anyway, good luck with all the work (I don't mean to pressure you guys, I love Titanium)

  2. Stephen Tramer 2011-04-15

    Unable to reproduce, 1.6.0RC1 (no CPU spike or deadlock). Never observed this behavior in KS in previous versions. Going to mark invalid.

  3. Lee Morris 2017-03-09

    Closing ticket as invalid.

JSON Source