Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add Custom Fonts In Xcode 4.1

i want to use custom fonts in y application.

i have declared the "Fonts provided by the application" in the info.Plist file

and set the label.font to the font with name with / without the .TTF extension

draged the TTF file in to the project and copied the file to the project

created an outlet to the label but still, nothing works.

if someone knows what is going on over there i would like to get some help.

recently i have noticed the this problem are known @ the 4.1 (xcode version).

TNX :)

like image 575
or azran Avatar asked Sep 04 '11 07:09

or azran


People also ask

How do I add custom fonts to Swift 4?

Add this by drag and drop to your files on the left side of the project. Add your CUSTOM fonts to the info. plist file. Make sure that you've linked all custom fonts you need: "Build Phases" -> "Copy Bundle Resources" -> "+" add your font.

How do I import fonts to iOS?

You can download fonts from the App Store app , then use them in documents you create on iPhone. After you download an app containing fonts from the App Store, open the app to install the fonts. To manage installed fonts, go to Settings > General, then tap Fonts.

How do I use custom fonts in Xcode 13?

Add the font file to your Xcode project Select File menu > Add Files to "Your Project Name"... from the menu bar, select all the fonts you need to add, then click the Add button. Or drag the file from Finder and drop it into your Xcode project. Drag the font files from Finder and drop it into your Xcode project.


2 Answers

The font name isn't the name of the file. What you want to do is double click on the font in Finder.

This should open it in Font Book like this image

The font name you want is the one in the title which I've highlighted so attractively in red.

like image 87
Sherman Lo Avatar answered Oct 23 '22 09:10

Sherman Lo


I just spent a big chunk of my day trying to figure my problem out... what I missed was, when I dragged the .ttf file into xcode, I did not select my app's name under "Add to target:" section.

Even though it seemed as if the file was in the correct directory and what not, it wasn't recognising it under the family names, using this code:

NSLog(@"FONT FAMILIES\n%@",[UIFont familyNames]);

So hopefully this can help someone if they're stuck.

like image 45
Mario Avatar answered Oct 23 '22 09:10

Mario