Sometimes it's very useful to check, which UIFonts are already available, and which should be imported. In this little tutorial, I will show, how can you import your own custom UIFont, and how can you check the available UIFonts and Families in your Xcode Project. IOS 9.3 Xcode 7.3
Create a SingleView Xcode Project. In your ViewController.m file put this code to write out in Log your all available UIFonts:
Now run your project and check the logs. My result is this:
If you have one ok, if you need on, download here a new Font: www.google.com/fonts
Find one, which isn't in your Log list! :) I use here Lato.
2.1 Download and Add to your Xcode Project
Download it with click on the right small arrow, and choose .zip. After that, drag and drop in Xcode into your Support Files.
2.2 Now you need to add your new File names at Info.plist file.
Click on your Info.plist file, and at "Information Property List" click the plus button, and search (start to type) for "Fonts provided by application".
Add new File names as new Items. (Very important to use the exact name of the Font file!)
2.3. Check it!
And Check your Target at Build Phases under the "Copy Bundle Resources", that your all imported files are there!
If everything works fine, you can check your available UIFonts again. Run your App. And in Log with cmd+f search for your new Font Name. (First trash your log ;)
Now you can see your new UIFont names. You must to use these names in your log, if you use it with this form for instance: "string.font = [UIFont fontWithName:@"Lato-Black" size:12];" Sometimes what you can see in log is different from your exact File name. Therefore you need to check it always after your import.
And of course, if you don't add your Font name to your Info.plist file, that will be mot available in your App. At me, I added just 4 type of this Font Family, and if I want to use "Lato-Italic", that will be not work, because I didn't add it to the Info.plist file.
Download the Xcode template from Github.
If you would like to be notified of my new solutions, please subscribe to my Newsletter or my youtube channel and/ or follow me on Facebook or Twitter! Check Footer section for these opportunities!