Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom fonts in Interface Builder

So we're in 2014, is there any way to set custom fonts within Interface Builder yet? Ie don't do it programmatically, except for "Fonts provided by application" in the app's plist.

like image 387
Jonny Avatar asked Feb 26 '14 08:02

Jonny


People also ask

How do I add custom fonts to Xcode?

Add the Font File to Your Xcode Project To add a font file to your Xcode project, select File > Add Files to “Your Project Name” from the menu bar, or drag the file from Finder and drop it into your Xcode project. You can add True Type Font (. ttf) and Open Type Font (. otf) files.


3 Answers

Yes, Marrius is right. In Xcode 6, you neither need to use extra software nor to set Font in Code files. Just add your font files in your project along with other files. And Interface builder will display the added fonts in the Custom Font List.

And the most amazing thing is, xcode 6 shows the applied font instantly in IB. This is the great addition by Apple.

Also make sure to add this key "Fonts provided by application" in your project's info.plist and provide your font file names to see the effect in devices.

like image 53
Asif Bilal Avatar answered Sep 19 '22 18:09

Asif Bilal


In Xcode 6, we have custom fonts available in interface builder.

No need for extra software. Thank you Apple!

like image 37
Marius Popescu Avatar answered Sep 19 '22 18:09

Marius Popescu


In Xcode 6, just add the ttf file in your project and use it in storyboard through custom fonts. If you directly want to use it in your code without using it in storyboard then you have to add key "UIAppFonts" in projectName-Info.plist.

Example:

<key>UIAppFonts</key> 
<array>
    <string>Signika-Bold.ttf</string>
    <string>Signika-Regular.ttf</string>
    <string>Signika-Light.ttf</string>
    <string>Signika-Semibold.ttf</string>
</array> 

just before the line </dict> in projectName-Info.plist.

UIFont* font  = [UIFont fontWithName:@"Signika-Regular" size:25];
like image 20
ankurkumar Avatar answered Sep 19 '22 18:09

ankurkumar