Navbar fontFamily
Hi all
is there a way to set a font family for the nav bar? I mean, i need to use a Trebuchet for titles on the bar. I've tried to do this using setTitleControl but doesn't work.
http://pastie.org/892309
BTW, how titleControl works? Could be a way?
Thanks!
2 Answers
-
Accepted Answer
Hmm… I've looked at your code.
I wonder if one of these tricks might work:
var trebuchetTitle = Ti.UI.createLabel({ ... }); var imageView = Ti.UI.createImageView({ image:trebuchetTitle.toImage() }); win.titleControl = imageView;
Or:
var trebuchetTitle = Ti.UI.createLabel({ ... }); var f = Ti.Filesystem.getFile(Ti.Filesystem.tempDirectory, 'title.png'); f.write(trebuchetTitle.toImage()); win.titleImage = f.nativePath;
Or:
var button = Ti.UI.createButton({ enabled:false, style:Ti.UI.iPhone.SystemButtonStyle.PLAIN, title:'My Title', height:'auto', width:'auto', color:'#000', font:{fontFamily:'Trebuchet MS', fontSize:22} }); win.titleControl = button;
-
HI James
thanks for your prompt reply.
I've tried all your solutions but just the win.titleImage = f.nativePath; is quite working. I mean, it actually creates an image in Trebuchet but it's not well rendered.
Maybe it's not a Titanium lack of API to do that, maybe it's just that it can't be done. I'm investigating how extensively fontFamily can be used to alter text elements inside an app but I understand you can work just on a label/button base. You can't for ex. set a fontFamily to a whole win.d