关于iOS添加自定义字体、字体图的使用,oc和swift。

    xiaoxiao2026-01-02  10

    1、在Xcode项目中导入 字体库.tff 文件

    2、在info.plist 文件中添加  Key:    Fonts provided by application    Type:  Array    添加导入的tff文件名。

    3、调用字体库  UILabel 和 UIButton

    UIFont *font = [UIFont fontWithName:@"字体库文件名" size:70];

    timeLabel.font = font;

    UIButton * button = [UIButton buttonWithType:UIButtonTypeRoundedRect];

     _button.titleLabel.font = [UIFont fontWithName:@"字体库文件名" size:21];

    如果是字体图片库 -> 图片的文字编号是e907  

    在oc中调用  

    timeLabel.text = @"\U0000e907"  

    在swift中调用

    timeLabel . text = "\u{e603}"

    在storyBoard中  Font选择自定义字体 

    转载请注明原文地址: https://ju.6miu.com/read-1305592.html
    最新回复(0)