I have downloaded Open Sans font and added all the .tff
files into my Xcode project, and have checked the checkbox in "Target Membership" pane for each file. I have added the UIAppFonts
key and values in Info.plist, and I am sure that the values are typo-free. Plus, the .tff
files are added to "Copy Bundle Resources", and the custom font is showing up in Interface Builder. And then I changed the font of all the labels to Open Sans in the Interface Builder (no code).
But when I run the app in the simulator, all the labels and buttons are showing the system font in ultra small sizes, like this:
One thing to note is that I am using Xcode 7 beta 5, and the app's Base SDK is iOS 9.
But why is there this problem? Is it a bug? Thanks!
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.
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.
Check That fonts inside the proyect are part of the target. Select fonts, verify the property Target Membership for your app is checked at the right in File Inspector.
That solved the problem for me:
I recently encountered this problem too. But it only happened for one font-style of a font-family, the others worked fine. I could only solve it by using this font in a button, then the font was also available for other controls such as labels or the large title.
Blip, here's a photo of what I did in an empty "Single View" project. And, I could see the font on sim and IB editor. Anything look different for your project? Maybe recreate the basics in a new project, just to double check? All of my notes on the image were associated with my original thoughts...just use them for reference as you double check things.
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