RTLable

RTLabel 基于UILabel类的拓展,能够支持Html标记的富文本显示,它是基于Core Text,因此也支持Core Text上的一些东西。

 

特点

粗体和斜体

颜色和大小

下划线

缩进

字距

行距

超链接

 

用法

1)将RTLabel.h RTLabel.m 拖拽道你的工程中,导入Core Text.framework。添加头文件

[cpp] view plaincopy

 

1. #import "RTLabel.h"  

 

2)创建一个RTLabel

[cpp] view plaincopy

 

1.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>";  

2.   

3.RTLabel *label = [[RTLabel alloc] initWithFrame:...];  

4. [self addSubview:label];  

5.[label setText:sample_text];  

 

3)支持以下标签

[html] view plaincopy

 

1. <b>Bold</b>  粗体

2. <i>Italic</i>  斜体

3. <bi>Bold & Italic</bi>  

4. <u>underline</u><u color=red>underline with color</u>  

5. <a href='http://..'>link</a>  

6. <uu>double underline</uu> , <uu color='#ccff00'>double underline with color</uu>  

7. <font face='HelveticaNeue-CondensedBold' size=20 color='#CCFF00'>custom font</font>  

8. <font face='HelveticaNeue-CondensedBold' size=20 color='#CCFF00' stroke=1>custom font with strokes</font>  

9. <font face='HelveticaNeue-CondensedBold' size=20 color='#CCFF00' kern=35>custom font with kerning</font>  

10. <p align=justify>alignment</p>  

11. <p indent=20>indentation</p>  

 

最低要求

• ARC -RTLabel使用了ARC,如果你的工程没有使用ARC,在编译时 compiler flag 添加 '-fobjc-arc'(如下图显示)

• XCode 4.4 或以上新版本

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值