I've read the available font families by [UIFont familyNames]
, but I've got various lists on different devices (but with the same iOS version). Can somebody tell me, if the fonts listed with the method above, are including custom fonts provided by other installed applications or if those are only the fonts shipped with iOS?
Press the Settings button in the upper-right corner of the screen. Tap on Fonts. Under the Select Font list, choose your desired font style. Tap Done.
Yes, it shows all the fonts within your app, including the custom fonts you've added. Here's the shorter code to list all the fonts:
for (NSString *familyName in [UIFont familyNames]){ NSLog(@"Family name: %@", familyName); for (NSString *fontName in [UIFont fontNamesForFamilyName:familyName]) { NSLog(@"--Font name: %@", fontName); } }
for familyName:AnyObject in UIFont.familyNames() { print("Family Name: \(familyName)") for fontName:AnyObject in UIFont.fontNamesForFamilyName(familyName as! String) { print("--Font Name: \(fontName)") } }
for familyName:String in UIFont.familyNames { print("Family Name: \(familyName)") for fontName:String in UIFont.fontNames(forFamilyName: familyName) { print("--Font Name: \(fontName)") } }
Here is the correct snippet for listing out all the fonts:
// List all fonts on iPhone NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]]; NSArray *fontNames; NSInteger indFamily, indFont; for (indFamily=0; indFamily<[familyNames count]; ++indFamily) { NSLog(@"Family name: %@", [familyNames objectAtIndex:indFamily]); fontNames = [[NSArray alloc] initWithArray: [UIFont fontNamesForFamilyName: [familyNames objectAtIndex:indFamily]]]; for (indFont=0; indFont<[fontNames count]; ++indFont) { NSLog(@" Font name: %@", [fontNames objectAtIndex:indFont]); } }
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