我尝试加载以下字体
SenticoSansDT - Light
SenticoSansDT - Regular
SenticoSansDT - Thin
SenticoSansDT - Medium
都是后缀为.ttf的字体文件
我添加到 Xcode 并检查目标。在构建阶段添加字体以及 info.plist。但我只看到要启用的 Regular 和 Light 字体。字体簿和 Storyboard 中均未显示 Medium
最佳答案
在 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”字体名称。
关于ios - SenticoSansDT - 中型和薄型不在 xcode 中加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36130065/