我正在按照本教程:Font size on universal storyboard使用适用于iPad或iPhone的字体,它使用的是System字体但不使用自定义字体。这就是'正常或我还没有导入更正我的自定义字体?
下拉列表:
答案 0 :(得分:0)
以下是使用自定义字体时常见的错误,只需执行所有步骤。
第1步:在XCode项目中包含您的字体
第2步:确保它们已包含在目标
中步骤3:仔细检查您的字体是否包含在捆绑包中的资源
步骤5:找到字体名称
在Swift中
func displayAllFont(){
for family: String in UIFont.familyNames()
{
print("Family name: \(family)")
for names: String in UIFont.fontNamesForFamilyName(family)
{
print(" Font name: \(names)")
}
}
}
在Objective-C
中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]);
}
}
答案 1 :(得分:-1)
我遇到了同样的问题并通过将label's font attributes还原为系统而不是自定义字体来解决问题
然后以编程方式将字体更改为所需的自定义字体 像这样
[[UILabel appearance] setFont:[UIFont fontWithName:@"Frutiger" size:75.0]];