iOS 富文本类库RTLabel
来源:互联网 发布:php网站制作教程视频 编辑:程序博客网 时间:2024/06/05 16:03
本节关于RTLable基本介绍,原文来自 https://github.com/honcheng/RTLabel
RTLabel
基于富文本的格式,适用于iOS,类似HTML的标记。
RTLabel 基于UILabel类的拓展,能够支持Html标记的富文本显示,它是基于Core Text,因此也支持Core Text上的一些东西。
特点
- 粗体和斜体
- 颜色和大小
- 下划线
- 缩进
- 字距
- 行距
- 超链接
用法
1)将RTLabel.h 和 RTLabel.m 拖拽道你的工程中,导入Core Text.framework。添加头文件
- #import "RTLabel.h"
2)创建一个RTLabel
- NSString *sample_text = @"<b>bold</b>,<i>italic</i> and <u>underlined</u> text, and <font face='HelveticaNeue-CondensedBold' size=20 color='#CCFF00'>text with custom font and color</font>";
- RTLabel *label = [[RTLabel alloc] initWithFrame:...];
- [self addSubview:label];
- [label setText:sample_text];
3)支持以下标签
- <b>Bold</b>
- <i>Italic</i>
- <bi>Bold & Italic</bi>
- <u>underline</u>, <u color=red>underline with color</u>
- <a href='http://..'>link</a>
- <uu>double underline</uu> , <uu color='#ccff00'>double underline with color</uu>
- <font face='HelveticaNeue-CondensedBold' size=20 color='#CCFF00'>custom font</font>
- <font face='HelveticaNeue-CondensedBold' size=20 color='#CCFF00' stroke=1>custom font with strokes</font>
- <font face='HelveticaNeue-CondensedBold' size=20 color='#CCFF00' kern=35>custom font with kerning</font>
- <p align=justify>alignment</p>
- <p indent=20>indentation</p>
最低要求
- ARC -RTLabel使用了ARC,如果你的工程没有使用ARC,在编译时 compiler flag 上 添加 '-fobjc-arc'(如下图显示)
- XCode 4.4 或以上新版本。
原创博客欢迎转载分享,请注明出处http://blog.csdn.net/duxinfeng2010
0 0
- iOS 富文本类库RTLabel
- iOS 富文本类库RTLabel
- iOS 富文本类库RTLabel
- iOS 富文本类库RTLabel
- RTLabel富文本库
- ios 富文本编辑器
- iOS之富文本
- iOS之富文本
- ios之富文本
- iOS之富文本
- iOS之富文本
- iOS 富文本 AttributedString
- IOS-富文本
- iOS之富文本
- ios 富文本
- iOS AttributeString(富文本)
- iOS之富文本
- iOS之富文本
- C#正则表达式语法规则详解
- 关于V$OPEN_CURSOR
- Introduction to functional testing with Selenium in Django
- Spring定时任务的几种实现
- Activiti工作流引擎使用
- iOS 富文本类库RTLabel
- python文件和文件夹操作
- python 关于UTF-8 编码的问题
- APP设计师必读!快速适配iPhone6及plus的诀窍
- 常见面试之机器学习算法思想简单梳理
- openIOC
- 4,org.apache.hadoop.security.AccessControlException: Permission denied: user=root, access=WRITE, in
- Using a Postman http client for efficient HTTP testing
- 2014.09.16 mysql server has gone away的解决方式