问题描述
我试图把字体Hipchick加入到我的项目中,但是它不起作用。我已经测试了一些方法,并以此结束:和网站。 / b>字体到你的应用程序,你需要申请/写你的字体的真实姓名,所以检查
I am trying to include the font "Hipchick" into my project but it does not work. 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.
Here is some screens and code:
The font is added to the project: "hitch__.ttf"
It is added to the .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.
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
2 - Modify the application-info.plist file
.
3 - Add the key "Fonts provided by application" to a new row
4 - and add each .TTF
file (of font) to each line.
For more info read This and This site.
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?
这篇关于不能在项目中包含.ttf字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!