三步教你iOS导入字体文件

1.首先info.plist中加入属性Fonts provided by application,在item 0 处填写导入的ttf文件名

 

2.查出你导入字体的font name

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

 

3.就是这样简单的用了呗

UILabel * tempTwoLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 100, 300, 40)];
UIFont * fontTwo = [UIFont fontWithName:@”DFPWaWaW5-GB” size:15];
[tempTwoLabel setFont:fontTwo];
[tempTwoLabel setText:@”这是新字体——ONe—–>华康娃娃体”];
[self.view addSubview:tempTwoLabel]

标签