iOS导入字体包

步骤:

1.首先info.plist中加入属性Fonts provided by application,在item 0 处填写导入的ttf文件名,可一次填写多个,。。当然如果你的字库格式不是ttf,可以尝试直接更改文件后缀名。


2.此时,你的字体在xib中可以找到的,


或者你可以选择查出你导入字体的font name:  

NSArray * fontArrays = [[NSArray alloc] initWithArray:[UIFont familyNames]];
    for (NSString * temp in fontArrays) {
        NSLog(@"Font name  = %@", temp);
    }

3.如果你是想在代码中用的话,跟其他字体用法一样的,,

    UIFont * fontTwo = [UIFont fontWithName:@"Qanelas-HeavyItalic" size:13];

4.如果你遇到了问题,字体未能如期显示,那么请检查:

(1)字库不包含输入文字

(2)另一个是文件没有导入程序,查看target -> Build Phases -> Copy Bundle Resources下是否有你导入的字库资源

5.下载更多ttf文件:

http://www.webpagepublicity.com/free-fonts.html

猜你喜欢

转载自blog.csdn.net/u011189158/article/details/50247837
今日推荐