zoukankan      html  css  js  c++  java
  • iOS自定义字体无效问题

    加入了一个字体发现无效

    最主要的原因是引用的时候fontwithname用的时文件名,而不是字体的Family name

    要使用字体的Family name,而不是字体的文件名,弄错了将无法看到效果。

    NSArray *familyNames =[[NSArray alloc]initWithArray:[UIFont familyNames]];
    NSArray *fontNames;
    NSInteger indFamily, indFont;
    NSLog(@"[familyNames count]===%d",[familyNames count]);
    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]);

    }

    [fontNames release];
    }

    [familyNames release];

  • 相关阅读:
    HDU 5438 Ponds
    [HNOI2013]比赛
    [HNOI2009]最小圈
    【模板】高斯消元法
    控制公司 Controlling Companies
    sdut 2878 圆圈
    滑雪
    [ZJOI2010]排列计数
    [HNOI2003]激光炸弹
    [BZOJ 3732]Network
  • 原文地址:https://www.cnblogs.com/Leetvin/p/3765823.html
Copyright © 2011-2022 走看看