1. 首先下載你想要設(shè)置的字體庫瓤的,例如設(shè)置方正啟體簡體
2. 添加到工程脆烟,一定要注意勾選紅色框框處盅抚,默認是不勾選的
添加以后
3润脸、在plist文件中添加
4柬脸、現(xiàn)在已經(jīng)添加成功了,但是具體的FontName需要通過代碼去查找毙驯。代碼如下:
NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]];
NSArray *fontNames;
NSInteger indFamily, indFont;
for (indFamily=0; indFamily<[familyNames count]; ++indFamily)
{
NSLog(@"Family name: %@", [familyNames objectAtIndex:indFamily]);? ? ? ? fontNames = [[NSArray alloc] initWithArray:
[UIFont fontNamesForFamilyName:
[familyNames objectAtIndex:indFamily]]];
for (indFont=0; indFont<[fontNames count]; ++indFont)
{
NSLog(@"? ? Font name: %@", [fontNames objectAtIndex:indFont]);
}
}
5.因為方正字體的FontName都是FZ開頭倒堕,所以在打印出來的日志里面搜索FZ
方正啟體簡體的FontName就是FZQTJW--GB1-0,
6.字體庫已經(jīng)添加完畢爆价,現(xiàn)在可以去使用了垦巴,例如:
self.label.font = [UIFont fontWithName:@"FZQTJW--GB1-0" size:20];