我可以在UILabel中使用Tally标记字体吗?
苹果是否支持使用理货字体? 我从这里使用这个理货:http://www.subtangent.com/maths/resources.php
用这个编码:
UILabel *subtitle = [[UILabel alloc]initWithFrame:CGRectMake(125, 2, 185, 30)]; [subtitle setBackgroundColor:[UIColor clearColor]]; [subtitle setFont:[UIFont fontWithName:@"Tally_Regular.ttf" size:19.0]]; [subtitle setText:@"5"]; [subtitle setTextColor:[UIColor blackColor]]; [fLikeThis addSubview:subtitle];
然而,它没有按预期工作,不知道为什么,因为我也在“应用程序提供的字体”中input字体名称。
在“应用程序提供的字体”中,您需要添加文件名,例如您的ttf文件不是字体名称,请修改您的信息plist,如下所示: –
<key>UIAppFonts</key> <array> <string>yourfontfilename.ttf </string> </array>
并在标签中使用字体名称: –
[subtitle setFont:[UIFont fontWithName:@"fontname" size:19.0]];//This is your font name not your font file name.You can get font name by opening it with fontbook in mac.
如果仍然不工作,那么在ttf文件中可能是错误的。