【转】iOS- 详解文本属性Attributes
原文: http://www.cnblogs.com/qingche/p/3574995.html?utm_source=tuicool
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 设置文本扁平化
效果:
【转】iOS- 详解文本属性Attributes的更多相关文章
- iOS- 详解文本属性Attributes(转)
iOS- 详解文本属性Attributes 1.NSKernAttributeName: @10 调整字句 kerning 字句调整 2.NSFontAttributeName : [UIFont s ...
- iOS- 详解文本属性Attributes
1.NSKernAttributeName: @10 调整字句 kerning 字句调整 2.NSFontAttributeName : [UIFont systemFontOfSize:_fontS ...
- 给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 ...
随机推荐
- lc面试准备:Implement Stack using Queues
1 题目 Implement the following operations of a stack using queues. push(x) -- Push element x onto stac ...
- SQL*Net more data to client
The server process is sending more data/messages to the client. The previous operation to the client ...
- wpf 资源的重用
资源的利用 1) Window.Resource <Window.Resource> <ImageBrush x:Key="TitleBrush" TileMod ...
- ☀【SeaJS】SeaJS Grunt构建
如何使用Grunt构建一个中型项目?https://github.com/twinstony/seajs-grunt-build spmjshttp://docs.spmjs.org/doc/inde ...
- 直接拿来用!最火的android开源项目(一)
不好意思尊重一下作者咯.详情见:csdn:http://www.csdn.net/article/2013-05-03/2815127-Android-open-source-projects
- Android 国内镜像
Android SDK官网国内很难直接访问,除了FQ/VPN等方法还是很不方便. 原有的Android SDK直接下载因http://dl-ssl.google.com/android/reposit ...
- mac上的键盘生活——打字训练
我的打字真的很有问题,错误率实在是太高了,于是乎下定决心改掉打字习惯,起码为了对得起我的机械键盘 所谓双击键(shift)就是当一个键钮上有两个字符时的辅助选择键,像标注在数字1上的 !,就是在你 ...
- [JIT_APP]Activity生命周期相关的7个方法
先发一张安卓官方文档里面的Activity生命周期图解 下面在对这7个生命周期内相关的方法做一些简单的介绍 OnCreate() 当Activity被创建的时候,会自动运行该方法.该方法做一些初始化动 ...
- main函数的3个参数
最早是在MCU中使用C语言,MCU中的main函数没有参数. 后来在PC上面使用C语言,一般教程都写的是main函数有2个参数: int main(int argc, const char **arg ...
- hdoj 4786 Fibonacci Tree【并查集+最小生成树(kruskal算法)】
Fibonacci Tree Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)To ...