***Bug*** Label 'Auto' Height Broken in 1.4.2
This is the code being used( with the text being dynamically updated and changed )
var labelHere = Ti.UI.createLabel({
color:'#808080',
font:{fontSize:18,fontWeight:'bold', fontFamily:'Helvetica'},
textAlign:'left',
top:0,
left:0,
height:'auto',
width:319,
zIndex:3,
text:stringVariable
});
WORKS under
iOS 4.1
Mobile SDK 1.4.1.1
But it breaks when under
iOS 4.1
Mobile SDK 1.4.2
Whenever adding content to the label, the height does not increase and just shows ellipsis. When populating the label's text initially, it does have an 'auto' height, but it does NOT work when adding more to the label's text property after that initial setup.
any help would be greatly appreciated!!!
rocksteady,
danno~
6 Answers
-
Accepted Answer
dont add the height property in label….
-
more code showing it in context:
var scrollView = Titanium.UI.createScrollView({ contentWidth:320, layout:'vertical', contentHeight:'auto', top:0, showVerticalScrollIndicator:true, showHorizontalScrollIndicator:false }); var theView = Ti.UI.createView({ width:319, height:'auto', top:5, left:8 }); var labelHere = Ti.UI.createLabel({ color:'#808080', font:{fontSize:18,fontWeight:'bold', fontFamily:'Helvetica'}, textAlign:'left', top:0, left:0, height:'auto', width:319, zIndex:3, text:stringVariable }); theView.add(labelHere); scrollView.add(theView);
WORKS under iOS 4.1 Mobile SDK 1.4.1.1
But it breaks when under iOS 4.1 Mobile SDK 1.4.2is there a new, stable version that is above 1.4.2 that i can try out? or any other suggestions?
-
Danno
Try the latest Continuous Build, that you can download from the link in the install instructions page, and let us know if the problem persists.
-
just tried latest build and it did NOT fix the issue :(
rocksteady,
danno~ -
Try forcing a refresh on the parent scroll view and container view after you've updated the label text (by changing some random property):
labelHere.text = 'New string'; theView.width = 318; theView.width = 319; scrollView.contentWidth = 319; scrollView.contentWidth = 320;
Or even forcibly resetting the height of the label:
labelHere.text = 'New string'; labelHere.height = 20; labelHere.height = 'auto';
-
Danno
The label in this code changes height to accommodate the extra text after you click on the button, using android 2.2, Ti SDK 1.4.X. Would you test it in your environment?
Ti.UI.setBackgroundColor('#000'); var tabGroup = Titanium.UI.createTabGroup(); var window = Titanium.UI.createWindow({ title:'window 1', backgroundColor:'red' }); var button = Titanium.UI.createButton({ title:"change label", width:100 }); window.add(button); var stringVariable = "short label text"; var labelHere = Ti.UI.createLabel({ backgroundColor:'white', color:'#808080', font:{fontSize:18,fontWeight:'bold', fontFamily:'Helvetica'}, textAlign:'left', top:10, left:0, width:319, zIndex:3, text:stringVariable }); button.addEventListener('click',function(e) { labelHere.text = "this is some very long text to prove whether or not the label height will dynamically change accordingly"; }); window.add(labelHere); window.open();