ios - 不能将 .ttf 字体包含到项目中

标签 ios objective-c fonts xcode4.5

我正在尝试将字体“Hipchick”包含到我的项目中,但它不起作用。我已经测试了几种方法并以这个结束:iOS tips: Custom Fonts试图解决这个问题,但它仍然不起作用。

这是一些屏幕和代码:

enter image description here

字体添加到项目中:“hitch__.ttf”

enter image description here

它被添加到.plist。

enter image description here

它在包中。

enter image description here

这里是关于字体的信息。

- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.

NSLog(@"hipch___: %@",[UIFont fontNamesForFamilyName:@"Hipchick"]);



testLbl.font = [UIFont fontWithName:@"Hipchick" size:30];
testLbl.text = @"Frank Zappa";
}

我试过“Hipchick”、“hipchick”和“hitch__”,但它仍然显示错误的字体。

如果有任何帮助,我将不胜感激。

最佳答案

这是步骤,如何在应用程序中添加自定义字体。

1 - 在您的应用程序中添加.TTF 字体
2 - 修改 application-info.plist 文件
3 - 将键“应用程序提供的字体”添加到新行
4 - 并将每个 .TTF 文件(字体)添加到每一行。

enter image description here

有关更多信息,请阅读 ThisThis网站。

FOR MOREINFORMATION :

但是在你的应用程序中添加字体之后,你需要申请/写入你的字体的真实名称,所以检查How do I get the font name from an otf or ttf file?

关于ios - 不能将 .ttf 字体包含到项目中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15447558/

相关文章:

java - 如何在 Java SWING 中设置自定义字体的大小和其他属性(粗体、斜体等)

ios - 快速 pushViewController 内存

iOS Swift UIAlertView

ios - Facebook Graph 请求返回姓名但不返回电子邮件

ios - 如何在 Xcode Playground 中实现自定义字体

css - Google Font API 使用浏览器检测。如何获取 font-face 的所有字体变体

ios - NS无效参数异常 : +[NSBundle fyb_appTransportSecuritySettings]: unrecognized selector sent to class 0x3bd0c3c0

ios - 如何获取与其他不使用 id 字段相关的托管对象?

objective-c - 坐标区域的中心坐标

objective-c - UIAppearance 移除 UIPopoverController 的自定义 NavBar 背景