This article is 12 years old
The content here might be outdated as technology and best practices evolve quickly. While the concepts may still be valuable, please verify the information against current documentation and standards.
Enumerate fonts on your iOS device
When you work with custom fonts in your iOS projects, you’ll need to find out the correct name for your font.
You can do this by looping though all the font families and then use the font family name to loop through all the fonts that belong to the family.
The following function will take care of this and return you a nice list ordered per font family.
- (void)enumerateFonts {
NSLog(@"--Start enumerating font--");
for (NSString *fontFamilyStrings in [UIFont familyNames]) {
NSLog(@"Font family: %@", fontFamilyStrings);
for (NSString *fontStrings in [UIFont fontNamesForFamilyName:fontFamilyStrings]) {
NSLog(@"-- Font: %@", fontStrings);
}
}
NSLog(@"--End enumerating font--");
}
Swift
I’ve also created a gist on github You can find it right here.
About the Author
👋 Hi, I'm Frederik Jacques, a passionate iOS developer and entrepreneur with over a decade of experience building innovative mobile applications.
I love creating apps that solve real problems and bring joy to users. From educational tools to creative meme makers, I'm always exploring new ways to blend technology with user experience. When I'm not coding, you'll find me sharing insights about iOS development, app monetization, and the indie developer journey.