[翻译] FTCoreText
2014-04-16 20:48
316 查看
FTCoreText
An open source Objective-C interface component that makes use of the CoreText framework to render static text content using a highly customisable markup syntax.
FTcoreText 是一个开源的 OC 组件,使用了 CoreText 框架来渲染静态文本,具备很高的可定制性。
Use FTCoreTextView
1. Import FTCoreText(引入头文件)
#import FTCoreTextView.h
2. Create an instance of FTCoreTextView(创建一个实例变量)
3. Create styles to apply to the output by creating instances of FTCoreTextStyle(创建一个样式的实例变量)
// Draw text closed in <red> tag in red color // Example: <red>this will be drawn red</red> FTCoreTextStyle *redStyle = FTCoreTextStyle *imageStyle = [FTCoreTextStyle styleWithName:@"red"]; redStyle.color = [UIColor redColor];
4. Once styles are defined, apply them to the view:(将定义好的样式赋给view)
[ftCoreTextInstance addStyles:@[style1, style2, style3]];
5. Set text with corrent markdown to the FTCoreTextView
instance(给FTCoreTextView中的实例对象设置正确的标签)
ftCoreTextInstance.text = @"My text with <red>red</red> word.";
See the included examples project highlighting various features.
看看demo就知道怎么用了。
Elements
FTCoreText provides some interface element types for rendering content types commonly found on the web and printed media such as lists, images, links and suchlike.FTCoreText 提供了很多种类型的接口用来渲染常见的文本,诸如在网页上看到的或者印刷的媒体如列表,图片,链接之类的。
Included:
包含:
FTCoreTextTagDefault: the default style applied to the text.普通文本
FTCoreTextTagPage: Divide the text in pages. Markup:
<_page/>分页
FTCoreTextTagBullet: define styles for bullets. Markup:
<_bullet>content</bullet>.加粗
FTCoreTextTagImage: renders images. Markup:
<_image>imageNameOnBundle.extension</_image>显示图片
FTCoreTextTagLink: define style for links. Markup:
<_link>link_target|link - name</_link>. See
FTCoreTextViewDelegatefor responding to touch.链接地址
To use the included element types, set the name of an
FTCoreTextStylestyle instance to one of the string constant types above and use the markup specified. Example:
linkTypeFTCoreTextStyleInstance.name = FTCoreTextTagLink, and in the static content:
<_link>http://fuerteint.com|Fuerte International</_link>
为了使用这些要素,设置
FTCoreTextStyle 的实例变量的样式为上面中的一种,然后再用特殊标示符即可。
Notes
Use of the CoreText framework is available for iOS versions 3.2 and above.Although FTCoreTextView uses a similar markup syntax to HTML, most of the properties defined in the HTML specification are unsupported.
支持 CoreText 框架的 iOS 版本为 3.2 以上。
虽然 FTCoreTextView 提供了一个类似 HTML 的标签语言,但是,在 HTML 中定义的绝大部分语法是不支持的。
相关文章推荐
- LoadRunner与Winsock协议[翻译]
- 【翻译作品】JavaScript DOM学习第四章:getElementByTagNames
- 神器metasploit中Msfvenom 的用法(外文翻译转)
- 《The Swift Programming Language》中文翻译及读书笔记-page29
- Umbraco(3) - CSS & Javascript(翻译文档)
- 【翻译】C++程序员面试题 (1)
- Python in nutshell 2nd 简明翻译 (3)
- qt翻译---QSemaphore
- [翻译]Axure-Basic Interactions-原型设计工具Axure学习-第1.3节
- 【翻译自mos文章】使用asmcmd命令在本地和远程 asm 实例之间 拷贝asm file的方法
- LINQ↔Lambda↔SQL 互相“翻译”
- 金蝶EAS,数据中心密码翻译,数据库密码获取
- [翻译]Hello ASP.NET AJAX
- qt翻译--QDragMoveEvent拖放类
- 转载 以LibSvm为例给出weka输出结果的简单翻译 [WEKA使用]
- Ansible@一个高效的配置管理工具--Ansible configure management--翻译(十一)
- Terrier文档翻译:首页
- qemu源码编辑注意事项—暨HACKING文档翻译
- The Zen of CSS(翻译)(3)
- 自动机理论,语言和计算导论1.1节翻译