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.)
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
I am also experiencing the exact same issue. Any updates on this one yet?
Duplicate of TIMOB-8713
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)
Thank you!!!
Closing ticket as duplicate with reference to the linked issues.