iphone - 我可以在 UILabel 中使用 Tally 标记字体吗?

标签 iphone ios xcode uilabel

Apple 支持使用 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];

但是它没有按预期工作,不知道为什么,因为我还在“应用程序提供的字体”中输入了字体名称。

最佳答案

在“应用程序提供的字体”中,您需要添加文件名,例如你的 ttf 文件不是字体名称 按如下方式修改您的信息列表:-

<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 文件有问题。

关于iphone - 我可以在 UILabel 中使用 Tally 标记字体吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8484937/

相关文章:

iphone - 在 iPhone 中保存 session 数据

iphone - 为什么苹果这样做: MKMapRectIntersection(boundingMapRect, worldRect)?

ios - 根据表格 View 单元格中的内容更改 uilabel 高度

iphone - AVCapture追加SampleBuffer

ios - Xcode、Git、Jenkins、PhoneGap 1.5.0 构建错误

iphone - NSUserDefaults 设置

iphone - pushViewController 不适用于 TabbarController

ios - 当应用程序进入后台时停止AVAudioPlayer

ios - 在 PhotoKit 中删除 : can you skip "Recently Deleted"?

ios - 运行 React-native ios 模拟器时出现间歇性错误 ("couldn' t 启动您定义的模拟器,因为模拟器已启动”)