iOS - 外加字体(只需三步-教你轻松实现)
外加字体
1.首先info.plist中加入属性Fonts provided by application,在item 0 处填写导入的ttf文件名
eg:
<key>UIAppFonts</key>
<array>
<string>方正兰亭纤黑简体.TTF</string>
<string>FZXQJW_0.TTF</string>
<string>CODE LIGHT.OTF</string>
<string>CODE BOLD.OTF</string>
<string>逐浪细阁体.otf</string>
</array>
然后在TAGECT中导入字体关联Compile Source
2.查出你导入字体的font name
NSArray * fontArrays = [[NSArray alloc] initWithArray:[UIFont familyNames]];
for (NSString * temp in fontArrays) {
NSLog(@"Font name = %@", temp);
}
3.就是这样简单的用了呗
UILabel * tempTwoLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 100, 300, 40)];
UIFont * fontTwo = [UIFont fontWithName:@"DFPWaWaW5-GB" size:15];
[tempTwoLabel setFont:fontTwo];
[tempTwoLabel setText:@"这是新字体——ONe----->华康娃娃体"];
[self.view addSubview:tempTwoLabel]
最新文章
- 【转】C# 中 10 个你真的应该学习(和使用!)的功能
- 【原创】Android ExpandableListView使用
- Gate level Simulation(门级仿真)
- StringUtils 的用法
- 基于HTML5的Drag and Drop生成图片Base64信息
- 【转】【C#】C#性能优化总结
- 【BZOJ】【2879】【NOI2012】美食节
- spring autoWire注解和@resource注解区别
- mycat读写分离
- java基础语法笔记
- windows server 2008见安装IIS方法(解决)
- 博客word测试
- php---数组序列化
- Hibernate中的实体映射
- css选择器语法速查
- 利用idea解决git代码冲突问题
- 数据库(mysql)基本使用命令大全
- 【原】The Linux Command Line - Redirection
- jQuery应用实例1:定时弹出图片
- mysql运行警告
热门文章
- Maven的具体使用和优点
- AOP注解方式ApsectJ开发
- bookdown - 撰写和发表自己的网络书籍/文档
- 转:【微信公众号】微信snsapi_base静默授权与snsapi_userinfo网页授权的实现(不建议使用静默,直接用主动比较方便)
- C# 获取文件扩展信息-应用名称/作者等
- 运维笔记--ubuntu安装指定版本的RabbitMQ
- App installation failed (A valid provisioning profile for this executable was not found)
- dotfuscator 在混淆.Net Framework 4.0以上版本的时候报错的解决方法2
- Python个人笔记
- IDEA 2018 搭建 Spring MVC helloworld