iOS- 详解文本属性Attributes
1.NSKernAttributeName:
@10 调整字句 kerning 字句调整
2.NSFontAttributeName :
[UIFont systemFontOfSize:_fontSize] 设置字体
3.NSForegroundColorAttributeName
:[UIColor redColor] 设置文字颜色
4.NSParagraphStyleAttributeName :
paragraph 设置段落样式
NSMutableParagraphStyle *paragraph = [[NSMutableParagraphStyle alloc] init];
paragraph.alignment = NSTextAlignmentCenter;
6.NSBackgroundColorAttributeName:
[UIColor blackColor] 设置背景颜色
7.NSStrokeColorAttributeName
设置文字描边颜色,需要和NSStrokeWidthAttributeName设置描边宽度,这样就能使文字空心.
NSStrokeWidthAttributeName这个属性所对应的值是一个 NSNumber 对象(小数)。该值改变描边宽度(相对于字体size 的百分比)。默认为 0,即不改变。正数只改变描边宽度。负数同时改变文字的描边和填充宽度。例如,对于常见的空心字,这个值通常为3.0。
同时设置了空心的两个属性,并且NSStrokeWidthAttributeName属性设置为整数,文字前景色就无效果了

效果:


效果:

8. NSStrikethroughStyleAttributeName 添加删除线,strikethrough删除线

效果:

9. NSUnderlineStyleAttributeName 添加下划线

效果:

10. NSShadowAttributeName 设置阴影,单独设置不好使,必须和其他属性搭配才好使
和这三个任一个都好使,NSVerticalGlyphFormAttributeName,NSObliquenessAttributeName,NSExpansionAttributeName
11.NSVerticalGlyphFormAttributeName
该属性所对应的值是一个 NSNumber 对象(整数)。0 表示横排文本。1 表示竖排文本。在 iOS 中,总是使用横排文本,0 以外的值都未定义。

效果:

12. NSObliquenessAttributeName设置字体倾斜。

效果:

13. NSExpansionAttributeName 设置文本扁平化

效果:

//kCTFontAttributeName 这个键是字体的名称 必须传入CTFont对象//kCTKernAttributeName 这个键设置字体间距 传入必须是数字对象 默认为0//kCTLigatureAttributeName 这个键设置连字方式 必须传入CFNumber对象//kCTParagraphStyleAttributeName 段落对其方式//kCTForegroundColorAttributeName 字体颜色 必须传入CGColor对象//kCTStrokeWidthAttributeName 笔画宽度 必须是CFNumber对象//kCTStrokeColorAttributeName 笔画颜色//kCTSuperscriptAttributeName 控制垂直文本定位 CFNumber对象//kCTUnderlineColorAttributeName 下划线颜色
iOS- 详解文本属性Attributes的更多相关文章
- iOS- 详解文本属性Attributes(转)
iOS- 详解文本属性Attributes 1.NSKernAttributeName: @10 调整字句 kerning 字句调整 2.NSFontAttributeName : [UIFont s ...
- 【转】iOS- 详解文本属性Attributes
原文: http://www.cnblogs.com/qingche/p/3574995.html?utm_source=tuicool 1.NSKernAttributeName: @10 调整字句 ...
- 给iOS开发新手送点福利,简述文本属性Attributes的用法
给iOS开发新手送点福利,简述文本属性Attributes的用法 文本属性Attributes 1.NSKernAttributeName: @10 调整字句 kerning 字句调整 2.NSF ...
- IOS开发UI基础文本属性Attributes
文本属性Attributes 1.NSKernAttributeName: @10 调整字句 kerning 字句调整 2.NSFontAttributeName : [UIFont systemFo ...
- IOS详解TableView——选项抽屉(天猫商品列表)
在之前的有篇文章讲述了利用HeaderView来写类似QQ好友列表的表视图. 这里写的天猫抽屉其实也可以用该方法实现,具体到细节每个人也有所不同.这里采用的是点击cell对cell进行运动处理以展开“ ...
- CSS中详解hight属性
目录结构: // contents structure [-] hight属性值类型一览表 height的%的使用 定义 实例 需要注意的 参考文章 hight属性值类型一览表 value descr ...
- JAVAEE——spring01:介绍、搭建、概念、配置详解、属性注入和应用到项目
一.spring介绍 1.三层架构中spring位置 2.spring一站式框架 正是因为spring框架性质是属于容器性质的. 容器中装什么对象就有什么功能.所以可以一站式. 不仅不排斥其他框架,还 ...
- CSS中详解height属性
目录结构: contents structure [+] hight属性值类型一览表 height的%的使用 定义 实例 需要注意的 参考文章 hight属性值类型一览表 value describt ...
- oracle创建定时器详解|interval属性
定时任务首先先创建定时任务中的存储过程 create or replace procedure pro_jggl as ...
随机推荐
- java基础(59):Eclipse把自动括号匹配改成C++那样的(强迫症,没办法)
在Eclipse开发环境下依次选择: 1.Windows->Preferences->Java->Code Style->Formatter: 2.在Active Profil ...
- .NET 4.0 MemoryCache with SqlChangeMonitor
Summary There isn't a lot of documentation on the internet about how to use the SqlChangeMonitor wit ...
- Java实现文件的读写,复制
import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.FileInputStr ...
- mysql取出现在的时间戳和时间时间戳转成人类看得懂的时间
mysql取出现在的时间戳和时间时间戳转成人类看得懂的时间,我们在mysql里面他封装了一个内置的时间戳转化的函数,比如我们现在的时间戳是:1458536709 ,"%Y-%m-%d&quo ...
- javax.transaction.xa.XAException: java.sql.SQLException: 无法创建 XA 控制连接。(SQL 2000,SQL2005,SQL2008)
javax.transaction.xa.XAException: java.sql.SQLException:无法创建 XA 控制连接.错误: 未能找到存储过程'master..xp_sqljdbc ...
- Java简单数据类型转换
1. Integer<---String (1) Integer x = new Integer(Integer.parseInt(String)); 2. Integer<--- ...
- SuperSocket架构设计示意图【转】
转自:http://docs.supersocket.net/v1-6/zh-CN/Architecture-Diagrams 中文(中国)Toggle Dropdown v1.6Toggle Dro ...
- socket的心跳包机制
网络中的接收和发送数据都是使用操作系统中的SOCKET进行实现.但是如果此套接字已经断开,那发送数据和接收数据的时候就一定会有问题.可是如何判断这个套接字是否还可以使用呢?这个就需要在系统中创建心跳机 ...
- HDU 5934:Bomb(强连通缩点)
http://acm.hdu.edu.cn/showproblem.php?pid=5934 题意:有N个炸弹,每个炸弹有一个坐标,一个爆炸范围和一个爆炸花费,如果一个炸弹的爆炸范围内有另外的炸弹,那 ...
- Python+Django+Eclipse 在Windows下快速开发自己的网站
一.配置开发环境 我的开发环境是:Python3.3.2 + Django1.5.2 + Eclipse 1.安装Python 下载地址:http://www.python.org/getit/ 安装 ...