Custom Fonts in iOS


iOS 4 makes it easy to include custom fonts in your projects. Drop the file (CloisterBlack.ttf) into your project.  Open up your Info.plist file, create a key called UIAppFonts and make it an array. Add the filename of the font as a value.
UIAppFonts

        CloisterBlack.ttf
Wherever you want to use the font in your application you can call:
[UIFont fontWithName:@"CloisterBlack" size:64.0]
Hum not quite, when I fired up my application I was met the the same old font - what gives?
Turns out (in my case) I should not be referencing the font by the value I supplied to my plist file. I opened my font in Font Book, and the 'name' has a good 'ol space in it.
[UIFont fontWithName:@"Cloister Black" size:64.0]

Custom Fonts in iOS Custom Fonts in iOS Reviewed by Unknown on 16:48 Rating: 5

No hay comentarios:

Con la tecnología de Blogger.