Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9103] iOS: Labels placed in tableview do not exhibit correct behavior when height is Ti.UI.SIZE

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionDuplicate
Resolution Date2012-06-01T10:32:56.000+0000
Affected Version/sRelease 2.0.1
Fix Version/sn/a
ComponentsiOS
LabelsSupportTeam, core
ReporterLuke Bartolomeo
AssigneeNeeraj Gupta
Created2012-04-29T09:27:03.000+0000
Updated2017-03-24T18:37:24.000+0000

Description

Problem Description

I noticed this behavior in an app I began developing with 1.8 when I upgraded to 2.0. I have a tableview that contains rows which each contain a label. The labels are of varying sizes and may span multiple lines. Sometimes, a label is truncated with ellipses (not the desired behavior). If a few more characters are added, the label displays the entire text (as I would expect) by adding an additional line.

Actual Results

The label does not expand to fill two lines and is thus truncated with ellipses. BUT, if I change the text of the label and make it SLIGHTLY longer to "I am a label that contains a lot of text.", the label correctly expands to fill two lines and display all of the text.

Expected Results

Label should expand if allowed.

Test Case

1. Mobile Project 2. Add this to app.js
Titanium.UI.setBackgroundColor('#000');
 
var win1 = Titanium.UI.createWindow({  
    title:'Window',
    backgroundColor:'#fff'
});
 
var label1 = Titanium.UI.createLabel({
    color:'#999',
    text:'I am a label that contains text.',
    font:{fontSize:20,fontFamily:'Helvetica Neue'},
    textAlign:'left',
    width: 250,
    height: Ti.UI.SIZE,
    backgroundColor: 'yellow',
});
 
win1.open();
 
tableview = Titanium.UI.createTableView({
    top : 0,
    //left: 0,
    allowsSelection : true,
    width : Ti.UI.FILL,
    height: Ti.UI.FILL,
    data : [],
    style : Titanium.UI.iPhone.TableViewStyle.PLAIN,
    backgroundColor : 'white',
    border: 1,
});
 
//win1.add(label1);
row = Ti.UI.createTableViewRow();
row.add(label1);
row.height = Ti.UI.SIZE;
var data = new Array();
data[0] = row;
tableview.setData(data);
win1.add(tableview);

Extra info

It should be noted that labels placed directly in a view (not in a tableview) correctly expand to the correct height all of the time when height is set to Ti.UI.SIZE. The unusual and undesired behavior exists only when the label is placed in a tableview. (Also, setting the height of the tableviewrow does not effect how the label appears.)

Comments

  1. Rob Marscher 2012-05-10

    Experiencing this exact issue. Also see discussion at http://developer.appcelerator.com/question/136177/label-does-not-exhibit-correct-multiline-behavior-inside-of-tableview-20
  2. Shebin Rawther 2012-05-31

    I am also experiencing the exact same issue. Any updates on this one yet?
  3. Vishal Duggal 2012-06-01

    Duplicate of TIMOB-8713
  4. Sabil Rahim 2012-06-01

    Fix Back ported to 2_0_X by [PR2305](https://github.com/appcelerator/titanium_mobile/pull/2305) and the fix should be available on 2_0_X branch from commit [a43004b8e](https://github.com/appcelerator/titanium_mobile/commit/a43004b8eb830edfb22f8ef21f3d37ac1e6ab9f0)
  5. Rob Marscher 2012-06-01

    Thank you!!!
  6. Lee Morris 2017-03-24

    Closing ticket as duplicate with reference to the linked issues.

JSON Source