iOS 加入自定义字体方法
1.网上搜索字体文件(后缀名为.ttf,或.odf)
2.把字体库导入到工程的resouce中
3.在程序添加以下代码 输出所有字体
NSArray *familyNames = [UIFont familyNames];
for( NSString *familyName in familyNames ){
printf( "Family: %s \n", [familyName UTF8String] );
NSArray *fontNames = [UIFont fontNamesForFamilyName:familyName];
for( NSString *fontName in fontNames ){
printf( "\tFont: %s \n", [fontName UTF8String] );
}
}
4.假如你加入的字体为微软雅黑,这时可以在NSLog中看到MicrosoftYaHei
5. 然后在你的工程的Info.plist文件中新建一行(Add Row),添加key为:UIAppFonts,类型为Array或Dictionary都行;在UIAppFonts下再建立一个键值对,key 为:Item 0,添加Value为XXX.ttf(你字体的名字,string型),可以添加多个
6.在你的项目里要用字体的时候 xx.font = [UIFont fontWithName:@"MicrosoftYaHei" size:20.0],这样就可以了。
iOS 加入自定义字体方法的更多相关文章
- iOS使用自定义字体的方法(内置和任意下载ttf\otf\ttc字体文件)
最近做了个有关阅读的应用,使用了自定义字体,学习了一下这方面的知识. 1.首先是最简单也普遍的做法,打包内置字符库文件: 把字体库文件添加到工程,如font1.ttf添加到工程,然后在工程plist添 ...
- iOS - 使用自定义字体-苹方字体
苹方提供了六个字重,font-family 定义如下:苹方-简 常规体font-family: PingFangSC-Regular, sans-serif;苹方-简 极细体font-family: ...
- 【转】IOS版本自定义字体步骤
本文转载自:http://quick.cocoachina.com/wiki/doku.php?id=ios%E7%89%88%E6%9C%AC%E4%BD%BF%E7%94%A8%E8%87%AA% ...
- ios 使用自定义字体
本文转载至 http://blog.csdn.net/yesjava/article/details/8447596 1.下载要使用的自定义字体,格式通常为ttf.otf文件.这里假设是nokia ...
- iOS开发自定义字体之静态字体
最后更新 2017-04-25 在iOS开发中经常会用到字体, 一般字体文件比较小的,单一的,几十k, 可以通过内置进去;如果字体文件比较多或者字体文件比较大,通常通过动态加载方式. 静态加载方式 将 ...
- iOS使用自定义字体
http://blog.csdn.net/heartofthesea/article/details/22289399 1.将准备好的字体文件加入项目中 2.打开Build Phases—Copy B ...
- iOS:自定义字体
转自: <iOS tips: Custom Fonts> Post by Steve Vlaminck My good friend google told me that using a ...
- css网页使用自定义字体方法
@font-face可以加载服务器端的字体到浏览器端,这样设计师就可以不受客户端字体库的限制. 一般来说有四种格式的字体文件即可覆盖所有浏览器.这四种格式为: .EOT:适用于Internet Exp ...
- 【Android 界面效果42】如何自定义字体
项目里要统一用设计师的字体,android:typeface只支持系统三种字体.有什么比较好的做法? 你需要为整个应用替换自定义字体. 解决方案 1)Android默认方法 #1 你可以通过ID查找到 ...
随机推荐
- Redis GEO ,GEOHASH,Spatial_index
https://matt.sh/redis-geo http://antirez.com/latest/0 http://invece.org/ https://github.com/davidmot ...
- JSBinding + SharpKit / 原理篇:Delegate
以 NGUI 的 UIEventListener 为例: 有一个类: using SharpKit.JavaScript; using UnityEngine; using System.Collec ...
- 一个不错的vim配置
set nocp set backspace=indent,eol,start set number set autoindent set nocompatible set bs=indent,eol ...
- linux中Zabbix邮件报警设置配置步骤
使用外部邮箱账号发送报警邮件设置 配置Zabbix服务端外部邮箱 vi /etc/mail.rc #编辑,添加以下信息 set from=xxx@163.com smtp=smtp.163.com s ...
- Oracle 11g 数据库自动备份执行脚本
@echo offsetlocal enabledelayedexpansiontitle %date% %time:~,8% by LiaoNing Sunray Software Technolo ...
- html之input系列标签
input属性太多,我这里仅列出几个我喜欢的吧. disabled:首次加载时禁用此元素 checked:首次加载时选中此元素 form:输入字段所属的一个或多个表单 hieght:定义input字段 ...
- java找jar包、搜索class类 搜索maven
sourceforge.net https://github.com/ http://www.findmaven.net/搜索class类 http://mvnrepository.com/
- [Hibernate] - Fetching strategies
Hibernate中的抓取策略,参考文档: http://docs.jboss.org/hibernate/orm/3.5/reference/zh-CN/html/performance.html ...
- Servlet Filter 3
11.MD5加密 /** * 使用md5的算法进行加密 */ public static String md5(String plainText) { byte[] secretBytes = nul ...
- 【linux】常见的网络管理命令
last:查看目前和过去的用户登录信息 [root@paulinux ~]# last root pts/0 192.168.1.106 Fri Jun 10 09:53 still logged i ...