(转载)IOS 加载自定义字体

http://www.jianshu.com/p/d728570bdf7b

1.下载所需要的ttf文件,导入工程中,在Info.plist中添加一项:Fonts provided by application,填写字体文件名称加后缀.

2.前往TARGETS -> Build Phases -> Copy Bundle Resources中添加字体文件

3.通过眼力找到字体文件对应的fontName,暂未有更好的方法,如有请告知,谢谢~

NSArray *familyNames = [UIFont familyNames]; for( NSString *familyName in familyNames ) { NSArray *fontNames = [UIFont fontNamesForFamilyName:familyName]; for( NSString *fontName in fontNames ) { printf( “\tFont: %s \n”, [fontName UTF8String] ); } }

4.使用自定义字体

self.Label.text = @”钟齐流江毛笔草体”; self.Label.font = [UIFont fontWithName:@”LiuJian-Mao-Cao-2.0” size:30];

self.Label2.text = @”蒙纳漫画体”; self.Label2.font = [UIFont fontWithName:@”MComicHK-Medium” size:30];

```

Loading Disqus comments...
Table of Contents