Say you want a specific font for UIFont. How do you know what it's called?
E.g. if you wanted to use this code:
[someUILabelObject setFont:[UIFont fontWithName:@"American Typewriter" size:18]];
From where do you copy the exact phrase "American Typewriter". Is there a header file in Xcode?
UPDATE
Also found this handy.
Overview. Use UIFont to access your font's characteristics within your app. It also provides the system with access to the glyph information, used during layout. Font objects are immutable, so it's safe to use them from multiple threads in your app.
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.
Might be interesting for you as Quick Win within the Debugger:
(lldb) po [UIFont fontNamesForFamilyName:@"Helvetica Neue"] (id) $1 = 0x079d8670 <__NSCFArray 0x79d8670>( HelveticaNeue-Bold, HelveticaNeue-CondensedBlack, HelveticaNeue-Medium, HelveticaNeue, HelveticaNeue-Light, HelveticaNeue-CondensedBold, HelveticaNeue-LightItalic, HelveticaNeue-UltraLightItalic, HelveticaNeue-UltraLight, HelveticaNeue-BoldItalic, HelveticaNeue-Italic )
November 2018 - Update A new swift-y reference for "Custom Fonts with Xcode" - by Chris Ching. I had to update, as this is a great value posting for the new way combined with all missing parts to use custom fonts in a project.
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