您的位置:首页 > 移动开发 > IOS开发

三步教你iOS导入.ttf字体文件

2013-05-24 12:06 357 查看
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]

------------觉得好就顶一下吧
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: