美文网首页
iOS 工程中添加自定义字体

iOS 工程中添加自定义字体

作者: aaa000 | 来源:发表于2017-04-26 10:24 被阅读40次

    1.下载 .ttf 格式的字体支持文件
    2.将下载的文件加入到工程中

    1. 在工程的info.plist文件中加入Fonts provided by application 项 并且加入文件名称
    701746B7-1B3D-43CE-8FBD-0513388A4940.png

    4.在控制台打印输出 当前支持的所有字体名称

    for(NSString*fontFamilyName  in  [UIFontfamilyNames])    {
            NSLog(@"family:'%@'",fontFamilyName);
            for(NSString*fontName  in  [UIFontfontNamesForFamilyName:fontFamilyName])      {
                  NSLog(@"\tfont:'%@'",fontName);  
          }
     }
    
    64623491-0950-4115-AF51-47D3CC71C990.png

    5.找到新加入的字体名称 eg:Tensentype-XingKaiF
    使用

    label.font = [UIFont fontWithName:@"Tensentype-XingKaiF" size:18];
    

    相关文章

      网友评论

          本文标题:iOS 工程中添加自定义字体

          本文链接:https://www.haomeiwen.com/subject/dpcizttx.html