我尝试加载以下字体
SenticoSansDT - Light
SenticoSansDT - Regular
SenticoSansDT - Thin
SenticoSansDT - Medium
都是扩展名为.ttf
的字体文件我添加到Xcode并检查目标。在构建阶段添加了字体以及info.plist。但我只看到要启用的Regular和Light字体。媒体书中没有显示媒体,也没有在故事板中显示
答案 0 :(得分:3)
在mac上安装.ttf文件,并使用下面的代码查找字体的确切名称。
NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]];
NSArray *fontNames;
NSInteger indFamily, indFont;
NSInteger fontsCount = [familyNames count];
for (indFamily = 0; indFamily < fontsCount; ++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]);
}
}
使用日志上打印的字体名称“SenticoSansDT Medium and Thin”。