views:

63

answers:

2

Is it possible to use UIButtons with my own true type font? I found the FontLabel open source that can use ttf with UILabels, but unfortunately I can't set my UIButton's titleLabel to a created FontLabel. Can someone offer a simple solution to this? Or should I just not be using UIButtons altogether and instead use something else? I feel like I'm missing something obvious because I can't imagine there wouldn't be some truetype functionality in some default button offering.

+2  A: 

As of the 3.2 SDK, you can include your own ttf fonts in your app. Just include the font file in your bundle and add the UIAppFonts key to your info.plist. (http://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/doc/uid/TP40009252-SW18)

You should then be able to create the font as you would any built-in font and use it as the font for your button's label.

Robot K
So far, when I add UIAppFonts as a key and then create an array with my font (with extension), the app just hangs when I launch it. It definitely has to do with some failure to load the font because when I enter invalid filenames in the array, the app launches fine. It's only when I add correct filenames that it appears to be finding it and hanging at the startup screen.
Joey
I guess this is looking like a bug on apple's side: http://web.archiveorange.com/archive/v/nagQXB5eX3YsQpevIXMk appearing on ipad. :(
Joey
Ugh. Make sure you file a bug at http://bugreport.apple.com. Even if you know it's a dupe, it count's as a "please fix this bug!" vote.
Robot K
A: 

For those of you having this problem and looking for a workaround, this worked for me (link to a question I posed and later answered):

http://stackoverflow.com/questions/3841929/advice-on-debugging-a-uiappfonts-issue-on-ipad

Joey