zoukankan      html  css  js  c++  java
  • iOS使用自定义字体

    1.将准备好的字体文件加入项目中

    2.打开Build Phases—Copy Bundle Resources,确保刚添加的字体文件在列表中,否则需要手动加到这里

    3.编辑”项目名-Info.plist”文件
    (1)addRow—Fonts provided by application

    (2)将加入的字体名连同扩展名填在这里

    4.在Mac下双击字体文件,在标题栏中找到字体的fontName

    5.打印出系统所有的字体名

    NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]];
        NSArray *fontNames;
        NSInteger indFamily, indFont;
        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 is %@", [fontNames objectAtIndex:indFont]);
            }
            [fontNames release];
        }
        [familyNames release];

    6.这样就可以使用了[UIFont fontWithName:@"chenweixun-yingxing" size:20];

    7.只有文件里配的字才会转换。 

  • 相关阅读:
    线程(中)
    线程
    生产者消费者模型
    进程的常用方法
    HTML中head与body标签
    HTTP协议
    mysql:视图,触发器,事务,存储过程,函数。
    关于MySQL中pymysql安装的问题。
    MySQL多表查询,pymysql模块。
    MySQL之单表查询
  • 原文地址:https://www.cnblogs.com/swallow37/p/3936581.html
Copyright © 2011-2022 走看看