我在这里阅读了关于 XCode 中自定义字体的不同答案,但我仍然无法让它工作。
我做了什么:
将其添加到 Plist。将其添加到复制绑定资源。
如果我做:
for ( NSString *familyName in [UIFont familyNames] )
{
NSLog(@"Family: %@", familyName);
NSLog(@"Names = %@", [UIFont fontNamesForFamilyName:familyName]);
}
它将打印它:
2013-03-26 17:04:52:214 Appname[21704:2311] Family: Patrick Hand
2013-03-26 17:04:52:217 Appname[21704:2311] Names = (
"PatrickHand-Regular"
)
而且我尝试使用以下两种方式设置字体:
self.usernameLabel.font = [UIFont fontWithName:@"PatrickHand-Regular" size:30];
和
self.usernameLabel.font = [UIFont fontWithName:@"PatrickHand" size:30];
我最绝望的尝试是这样的:
for ( NSString *familyName in [UIFont familyNames] )
{
NSLog(@"Family: %@", familyName);
NSLog(@"Names = %@", [UIFont fontNamesForFamilyName:familyName]);
[self.usernameLabel setFont:[[UIFont fontNamesForFamilyName:familyName] objectAtIndex:0]];
if ( [familyName isEqualToString:@"Patrick Hand" ])
{
NSLog(@"BREAK!");
break;
}
}
但它仍然没有改变。
建议尝试什么?