iOS iconFont使用

iconFont 在iOS中的使用,首先登录iconfont 然后点击我的项目->下载到本地

然后解压 找到里面的 .ttf 字体库 把.ttf字体库添加到工程中 确保在copy bundle Resources中有添加入字体库,然后在info.plist文件中增加字段Fonts provided by application并在该字段下添加iconfont.ttf。 如果添加或改变图片需要重新导入字体库

此时只需要在工程使用该字体即可. 例如

UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(100, 100, 100, 50)];

//需要配置为对应的字体

label.font = [UIFont fontWithName:@"iconfont" size:24];

//配置上图标

label.text = @"\U0000e606";

//配置图标颜色

[label setTextColor:[UIColor cyanColor]];

posted @ 2018-02-07 09:59  yunfengning  阅读(178)  评论(0)    收藏  举报