Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-12037] iOS: label inside a table is not updated correctly

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2013-01-03T07:13:56.000+0000
Affected Version/sn/a
Fix Version/sRelease 3.0.1, Release 3.1.0, 2013 Sprint 01 API, 2013 Sprint 01
ComponentsiOS
Labelsmodule_label, qe-review, qe-testadded
ReporterDavide Cassenti
AssigneeVishal Duggal
Created2012-12-12T17:55:13.000+0000
Updated2014-06-19T12:44:32.000+0000

Description

Problem description

The value of a label - which is inside a TableViewRow - is changed using a slider; however, the size of the label is not updated, and iOS shows the ellipsis if the text is larger.

Steps to reproduce

Use the following code:
var win = Titanium.UI.createWindow({
    backgroundColor : 'white',
    layout:'vertical'
});

slider1 = Ti.UI.createSlider({
    top : 30,
    value : 0,
    min : 0,
    max : 50000,
    left : 0,
    right : 0
});

slider1.addEventListener('touchend', function(e) {
    slider1Change(e);
});

slider1.addEventListener('touchcancel', function(e) {
    slider1Change(e);
});

function updatePerMonthLabel(_val) {
    row.label.text = _val;
}

function slider1Change(e) {
    updatePerMonthLabel(slider1.value);
}

var row = Titanium.UI.createTableViewRow();

var horizontalView = Ti.UI.createView({
    layout : 'horizontal',
    left : '5%',
    right : '5%',
    height : Ti.UI.SIZE
});

var amountLabel = Titanium.UI.createLabel({
    left:0,
    text:'$0',
    top : 0,
    width : Ti.UI.SIZE,
    height : Ti.UI.SIZE
});

var yrLabel = Titanium.UI.createLabel({
    width : Ti.UI.SIZE,
    height : Ti.UI.SIZE,
    text : "Year",
    left : 10
});

horizontalView.add(amountLabel);
row.label = amountLabel;
horizontalView.add(yrLabel);

amountLabel = null;
yrLabel = null;

row.add(horizontalView);

var mainContentTableView = Titanium.UI.createTableView({
    data : [row]
});

win.add(slider1);
win.add(mainContentTableView)
win.open();
In the beginning, everything looks ok. Moving the slider, though, will not update the size of the label, and ellipsis are shown. Moving the slide back to zero, or clicking the row solves the issue for the following changes.

Comments

  1. Vishal Duggal 2013-01-02

    Pull pending https://github.com/appcelerator/titanium_mobile/pull/3652
  2. Vishal Duggal 2013-01-08

    Backports 3_0_X https://github.com/appcelerator/titanium_mobile/pull/3677 2_1_X https://github.com/appcelerator/titanium_mobile/pull/3676
  3. Shyam Bhadauria 2013-01-09

    Verified in the following environment: Titanium SDK: 3.1.0.v20130105233407 Titanium SDK:3.0.1.v20130108154840 Titanium  Studio:3.0.1.201212181159 Device: Simulator iOS 6.0

JSON Source