Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-1445] Updating a label in a table header view causes a layout issue

GitHub Issuen/a
TypeBug
PriorityTrivial
StatusClosed
ResolutionDuplicate
Resolution Date2012-06-22T14:37:51.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsdefect, header, ios, iphone, view
Reporterctredway
AssigneeVishal Duggal
Created2011-04-15T02:53:02.000+0000
Updated2017-03-09T22:49:40.000+0000

Description

A customer reported that when updating the text of a label in a header view, the headerView moves, jumping to the middle of the window. I have reproduced this as well in iOS 4 and sdk 1.4

FWIW, if the label is given a height of 35 it doesn't jump around

CODE:

var win = Ti.UI.createWindow({});

var data = [];

data[0] = Ti.UI.createTableViewRow({title:'Row 1'});
data[1] = Ti.UI.createTableViewRow({title:'Row 2'});
data[2] = Ti.UI.createTableViewRow({title:'Row 3'});
data[3] = Ti.UI.createTableViewRow({title:'Row 4'});

var headerView = Ti.UI.createView({height:'auto'});

var headerLabel = Ti.UI.createLabel({

text:'Here is some text for the header label.',
height:'auto',
left:10,
right:10

});

headerView.add(headerLabel);

var tableView = Ti.UI.createTableView({

style:Titanium.UI.iPhone.TableViewStyle.GROUPED,
top:0,
right:0,
left:0,
headerView:headerView,
data:data

});

win.add(tableView);

var button = Ti.UI.createButton({

title:'Change Header',
height:40,
width:150,
bottom:10

});

button.addEventListener('click', function()
{

headerLabel.text = 'This is some different text.';

});

win.add(button);

win.open();

Comments

  1. Blain Hamon 2011-04-15

    Note to self: This may be due to any change in header's height requiring a reload of the section, but still possible to compensate around this.

  2. Blain Hamon 2011-04-15

    Was this fixed in the refactor? We'll have to revisit it.

  3. Vishal Duggal 2012-06-22

    Duplicate of TIMOB-8503
  4. Lee Morris 2017-03-09

    Closing ticket as duplicate.

JSON Source