Welcome to the Treehouse Community
Looking to learn something new?
Easy way to add custom fonts to iOS apps!
Hey guys! After some research and experimentation I have found a really simple way to incorporate custom fonts into your iOS applications! I was looking around for a way to spruce up my Crystal Ball app with text that matched the app's title and "Shake to Predict" text. The font was one called Baldur.ttf and I had to download it online.
The first step is to create a 'Resources' folder if you don't already have one on the same level as Frameworks, Products, CrystalBall etc. Drag and drop your font into this folder. It will prompt you. Make sure your app is targeted and it is making a copy to the Resources folder. Next, open your ...-info.plist file and right or control-click to create a new key. Name this key 'Fonts provided by application' and it should auto-complete. Make sure it's an array and hit enter. Now under item 0's value column, click and type in the name of your font, including the extension. In my case that was Baldur.ttf. Finally, when you have some text you want to format, for example our prediction label, you use: self.predictionLabel.font = [UIFont fontWithName:@"YourFontName" size:12.0]; Easy as that! Just be sure that you use your actual font name which can be found by opening your font with Fontbook and looking at the top of the window. Mine was just Baldur.
Nice and useful post :)