简体   繁体   English

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

[英]Can not include .ttf font into project

I am trying to include the font "Hipchick" into my project but it does not work. 我试图将字体“Hipchick”包含到我的项目中,但它不起作用。 I have tested a few methods and ended up with this one: iOS tips: Custom Fonts to try to solve this but it still doesn't work. 我已经测试了一些方法并最终得到了这个: iOS技巧:自定义字体试图解决这个问题,但它仍然不起作用。

Here is some screens and code: 这是一些屏幕和代码:

在此输入图像描述

The font is added to the project: "hitch__.ttf" 该字体被添加到项目中:“hitch __。ttf”

在此输入图像描述

It is added to the .plist. 它被添加到.plist中。

在此输入图像描述

It is in the bundle. 它在捆绑中。

在此输入图像描述

Here is the info about the font. 这是有关字体的信息。

- (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";
}

I have tried "Hipchick", "hipchick" and "hitch__" but it still display the wrong font. 我试过“Hipchick”,“hipchick”和“hitch__”,但它仍然显示错误的字体。

I would really appreciate any help possible. 我真的很感激任何可能的帮助。

This is Step for, How to add custom font in Application. 这是步骤,如何在应用程序中添加自定义字体。

1 - Add .TTF font in your application 1 - 在您的应用程序中添加.TTF字体
2 - Modify the application-info.plist file . 2 - 修改application-info.plist file
3 - Add the key "Fonts provided by application" to a new row 3 - 将“应用程序提供的字体”键添加到新行
4 - and add each .TTF file (of font) to each line. 4 - 并将每个.TTF文件(字体)添加到每一行。

在此输入图像描述

For more info read This and This site. 欲了解更多信息阅读网站。

FOR MOREINFORMATION : 欲获得更多信息 :

But after adding font to your application, you need to apply/write real name of your font, so check How do I get the font name from an otf or ttf file? 但是在为应用程序添加字体后,您需要应用/写入字体的真实名称,因此请检查如何从otf或ttf文件中获取字体名称?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM