现在的位置: 首页 > 综合 > 正文

自定义Font

2018年02月02日 ⁄ 综合 ⁄ 共 521字 ⁄ 字号 评论关闭

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]

------------觉得好就顶一下吧

【上篇】
【下篇】

抱歉!评论已关闭.