Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
499 views
in Technique[技术] by (71.8m points)

iphone - Custom Fonts in Xcode 5

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...