Use +[UIFont familyNames]
to list all of the font family names known to the system. For each family name, you can then use +[UIFont fontNamesForFamilyName:]
to list all of the font names known to the system. Try printing those out to see what name the system expects. Example code:
static void dumpAllFonts() {
for (NSString *familyName in [UIFont familyNames]) {
for (NSString *fontName in [UIFont fontNamesForFamilyName:familyName]) {
NSLog(@"%@", fontName);
}
}
}
Put that in your app, call it, and see what you get. If you see a name in the output that looks appropriate for your font, use it. Otherwise, perhaps you haven't properly added the font to your app.
In swift 4.2+ use code given below:
func dumpAllFonts() {
for familyName in UIFont.familyNames {
for fontName in UIFont.fontNames(forFamilyName: familyName) {
print("(fontName)")
}
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…