[翻译] FTCoreText

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>. SeeFTCoreTextViewDelegatefor responding to touch.链接地址
To use the included element types, set the name of an FTCoreTextStyle style 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 中定义的绝大部分语法是不支持的。
[翻译] FTCoreText的更多相关文章
- 《Django By Example》第五章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者@ucag注:大家好,我是新来的翻译, ...
- 《Django By Example》第四章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:祝大家新年快乐,这次带来<D ...
- [翻译]开发文档:android Bitmap的高效使用
内容概述 本文内容来自开发文档"Traning > Displaying Bitmaps Efficiently",包括大尺寸Bitmap的高效加载,图片的异步加载和数据缓存 ...
- 【探索】机器指令翻译成 JavaScript
前言 前些时候研究脚本混淆时,打算先学一些「程序流程」相关的概念.为了不因太枯燥而放弃,决定想一个有趣的案例,可以边探索边学. 于是想了一个话题:尝试将机器指令 1:1 翻译 成 JavaScript ...
- 《Django By Example》第三章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:第三章滚烫出炉,大家请不要吐槽文中 ...
- 《Django By Example》第二章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:翻译完第一章后,发现翻译第二章的速 ...
- 《Django By Example》第一章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:本人目前在杭州某家互联网公司工作, ...
- 【翻译】Awesome R资源大全中文版来了,全球最火的R工具包一网打尽,超过300+工具,还在等什么?
0.前言 虽然很早就知道R被微软收购,也很早知道R在统计分析处理方面很强大,开始一直没有行动过...直到 直到12月初在微软技术大会,看到我软的工程师演示R的使用,我就震惊了,然后最近在网上到处了解和 ...
- ASP.NET MVC with Entity Framework and CSS一书翻译系列文章之第一章:创建基本的MVC Web站点
在这一章中,我们将学习如何使用基架快速搭建和运行一个简单的Microsoft ASP.NET MVC Web站点.在我们马上投入学习和编码之前,我们首先了解一些有关ASP.NET MVC和Entity ...
随机推荐
- scrapy 设置cookie池
代码已经很详细了,可以直接拿来使用了. 包含了: 从网页获取cookie 存入mongodb 定期删除cookie scrapy中间件对cookie池的取用 #!/usr/bin/python #co ...
- python mysql连接函数
def mysqlConnectionSql(sql,value): try: conn=MySQLdb.connect(host='127.0.0.1',user='webuser',passwd= ...
- react篇章-React State(状态)-数据自顶向下流动
<!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title&g ...
- 深入理解Git - Git底层对象
前篇: 深入理解Git - 一切皆commit 如何从稍微底层一点的角度,从底层实现理解一切皆commit ? 配合希沃白板课件食用,效果更佳: [希沃白板5]课件分享 : <Git 进阶 - ...
- 网站漏洞扫描工具Uniscan
网站漏洞扫描工具Uniscan 网站漏洞的种类有很多种,如何快速扫描寻找漏洞,是渗透测试人员面临的一个棘手问题.Uniscan是Kali Linux预先安装的一个网站漏洞扫描工具.该工具可以针对单 ...
- python pip 不能用报错: ImportError: No module named _internal
使用python pip安装包的时候报错: Traceback (most recent call last): File "/usr/local/bin/pip", line 7 ...
- android OOM 内存溢出
韩梦飞沙 韩亚飞 313134555@qq.com yue31313 han_meng_fei_sha 一个应用的可用内存是有限的,如果超过了可用的内存,就会内存溢出. 1,避免 已经不用的对 ...
- OI回忆录(流水账)
今天是NOI2017疏散日,晚上回到家在电脑前写下这篇回忆录. 初中参加过几次普及组,拿过一等奖,自招进slyz. 高一参加过CTSC2016,狗牌滚粗qwq 高二参加过WC2017,CTSC2017 ...
- windows提权的几种姿势
想象这种画面:你拿到了一台机器上Meterpreter会话了,然后你准备运行 getsystem 命令进行提权,但如果提权没有成功,你就准备认输了吗?只有懦夫才会认输.但是你不是,对吗?你是一个勇者! ...
- angularJS简介及其特点—— 五大特性,加快 Web 应用开发
AngularJS 是谷歌的一个 JavaScript 框架,旨在简化前端应用程序的开发. 一. 关于和jquery的比较 首先angular是一个mvc框架,它与jquery不同之处在于,前者致力于 ...