How would you add a custom font in Xcode 5 and how would you change every label in the project to that font? Because I've heard you can only do this programmatically?
You need to set every label programmatically with your custom Font.
To use custom font :
1/ add your custom font in your project like resources (font .ttf or .otf)
2/ in your info.plist add key UIAppFonts (Fonts provided by application) and and the name of each custom font (for example : SohoGothicStd.ttf)
3/ you can create macro for use your font
#define FONT_SOHO_STD(s) [UIFont fontWithName:@"SohoGothicStd" size:s]
4/ use this macro for a label par exemple :
_myLabel.font = FONT_SOHO_STD(15.0f);
I believe you need to use [UILabel appearance]
proxy to set custom font for all labels across your application. Add following lines to your AppDelegate
didFinishLaunchingWithOptions
function to set custom font for all UILabel
s in your project.
UIFont *newFont = [UIFont fontWithName:@"My-Custom-Font-Name" size:14]; [[UILabel appearance] setFont:newFont];
NOTE: You need to make sure your fonts are in your Xcode project.
Here are the steps you can follow to add custom font to the project.
Xcode
as a resourceInfo.plist
file called UIAppFonts
.UIAppFonts
arrayInfo.plist
Steps taken from: Can I embed a custom font in an iPhone application?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With