UIFont fontWithName font name

Snowcrash picture Snowcrash · Jun 18, 2012 · Viewed 74.3k times · Source

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.

Answer

andreas-supersmart picture andreas-supersmart · Jul 31, 2012

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.