How do you resize a label's font in an eventHandler?
I'm doing this currently and setting the font in the addEventListener is not working, the font resizes down to the device default, which I assume means I'm not doing it right. Any ideas?
var w = Ti.UI.createWindow({backgroundColor:'#fff'});
var b = Ti.UI.createButton({
title:'Click Me',
top:10,
height:40,
width:200
});
var lab = Ti.UI.createLabel({
text: 'test',
top: 150,
height: 140,
width: 300,
font:{fontSize:20},
color: '#c00',
backgroundColor: '#ccc'
});
w.add(b);
w.add(lab);
b.addEventListener('click', function()
{
lab.font = '{fontSize:100}';
});
w.open();
1 Answer
-
Nolan updated the ticket and let me know that the correct way to update the fontSize property is like so:
label.font = {fontSize:70};
I was mistakenly using single quotes around my object. Guess it was a long day.