win.setTitleControl
Hi! I want to change the font color of the navigation tab bar text, but the text is not shown. What am I doing wrong?
tableview.addEventListener('click', function(e)
{
if (e.rowData.url)
{
var win = Titanium.UI.createWindow({
url:e.rowData.url,
backgroundColor: e.rowData.backgroundColor,
barColor: e.rowData.backgroundColor
});
var trebuchetTitle = Titanium.UI.createLabel({
text:'My title',
height:'auto',
width:'auto',
shadowColor:'#aaa',
shadowOffset:{x:5,y:5},
color:'#000',
font:{fontFamily:'Trebuchet MS',fontSize:22},
textAlign:'center'
});
win.setTitleControl(trebuchetTitle);
}
}
5 Answers
-
reading this:
http://stackoverflow.com/questions/599405/iphone-navigation-bar-title-text-color
It comes to my mind that you might need to reduce the font size.
Let me know if is working :)
-
I reduced it to 14 and still the same problem
-
I do this in my apps - but I have the label added to view first :
var titleView = Ti.UI.createView({ width:210, height:40 }); var titleLabel = Titanium.UI.createLabel({ color:'#000', height:18, width:210, top:5, text:'A Trebuchet TItle', textAlign:'center', font:{fontFamily:'Trebuchet MS',fontSize:18,fontWeight:'bold'}, shadowColor:'#eee',shadowOffset:{x:0,y:1} }); titleView.add(titleLabel); win.titleControl = titleView;
hope this helps ;)
-
Hi! Thank you for your responses, but the title is not changing, only if I put the code in app.js (the main window). If I try to make a new window, through an event listener, then the title is not shown. I don't understand why?
-
I found the problem. My project was made with Titanium 1.2.1 version. I updated the version to 1.3 and made a new project, and now it's working. So it's a bug in 1.2.1