Make Better Things



I like to make better things.

How to use custom fonts in iPhone

Your designer has given you a artistic font which is not available on iPhone?

Well now in iOS sdk 4 you can use any font you wish.
You just need to drag the font’s ttf file in your resource folder and do this following entry in your info.plist file –

<key>UIAppFonts</key>
<array>
        <string>CloisterBlack.ttf</string>
</array>

UIAppFonts key accept a array so you can pass multiple fonts in it.

Now wherever you want to use the font in your application you can call:

[UIFont fontWithName:@"Cloister Black" size:64.0]

Just make sure you give the real font name in above code. The font file name and its “real font name” can be different, so just open the font in FontBook app and there you can see the real name of the font.

Hope it will save someone’s time.