iOS 富文本类库RTLabel
生活随笔
收集整理的這篇文章主要介紹了
iOS 富文本类库RTLabel
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
本文轉載至 http://blog.csdn.net/duxinfeng2010/article/details/9004749? #import?"RTLabel.h"??
2)創建一個RTLabel [cpp]?view plaincopyNSString?*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)支持以下標簽 [html]?view plaincopy<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>??
?
本節關于RTLable基本介紹,原文來自?https://github.com/honcheng/RTLabel
?
RTLabel
基于富文本的格式,適用于iOS,類似HTML的標記。 RTLabel 基于UILabel類的拓展,能夠支持Html標記的富文本顯示,它是基于Core Text,因此也支持Core Text上的一些東西。特點
- 粗體和斜體
- 顏色和大小
- 下劃線
- 縮進
- 字距
- 行距
- 超鏈接
用法
1)將RTLabel.h 和 RTLabel.m 拖拽道你的工程中,導入Core Text.framework。添加頭文件 [cpp]?view plaincopy2)創建一個RTLabel [cpp]?view plaincopy
3)支持以下標簽 [html]?view plaincopy
最低要求
- ARC -RTLabel使用了ARC,如果你的工程沒有使用ARC,在編譯時?compiler flag 上?添加?'-fobjc-arc'(如下圖顯示)
- XCode 4.4 或以上新版本。
總結
以上是生活随笔為你收集整理的iOS 富文本类库RTLabel的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 再见,2014;您好,2015!
- 下一篇: Easy Slider: 功能强大简单易