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>. SeeFTCoreTextViewDelegate for 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

  1. Use of the CoreText framework is available for iOS versions 3.2 and above.

  2. Although FTCoreTextView uses a similar markup syntax to HTML, most of the properties defined in the HTML specification are unsupported.

  3. 支持 CoreText 框架的 iOS 版本为 3.2 以上。
  4. 虽然 FTCoreTextView 提供了一个类似 HTML 的标签语言,但是,在 HTML 中定义的绝大部分语法是不支持的。

[翻译] FTCoreText的更多相关文章

  1. 《Django By Example》第五章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者@ucag注:大家好,我是新来的翻译, ...

  2. 《Django By Example》第四章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:祝大家新年快乐,这次带来<D ...

  3. [翻译]开发文档:android Bitmap的高效使用

    内容概述 本文内容来自开发文档"Traning > Displaying Bitmaps Efficiently",包括大尺寸Bitmap的高效加载,图片的异步加载和数据缓存 ...

  4. 【探索】机器指令翻译成 JavaScript

    前言 前些时候研究脚本混淆时,打算先学一些「程序流程」相关的概念.为了不因太枯燥而放弃,决定想一个有趣的案例,可以边探索边学. 于是想了一个话题:尝试将机器指令 1:1 翻译 成 JavaScript ...

  5. 《Django By Example》第三章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:第三章滚烫出炉,大家请不要吐槽文中 ...

  6. 《Django By Example》第二章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:翻译完第一章后,发现翻译第二章的速 ...

  7. 《Django By Example》第一章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:本人目前在杭州某家互联网公司工作, ...

  8. 【翻译】Awesome R资源大全中文版来了,全球最火的R工具包一网打尽,超过300+工具,还在等什么?

    0.前言 虽然很早就知道R被微软收购,也很早知道R在统计分析处理方面很强大,开始一直没有行动过...直到 直到12月初在微软技术大会,看到我软的工程师演示R的使用,我就震惊了,然后最近在网上到处了解和 ...

  9. ASP.NET MVC with Entity Framework and CSS一书翻译系列文章之第一章:创建基本的MVC Web站点

    在这一章中,我们将学习如何使用基架快速搭建和运行一个简单的Microsoft ASP.NET MVC Web站点.在我们马上投入学习和编码之前,我们首先了解一些有关ASP.NET MVC和Entity ...

随机推荐

  1. Entity Framework Code First 在Object Join Linq查询时出现全表查询的语句。

    最近一个项目,使用微软的Entity Framework的ORM框架的项目,部署到现场后,出现了系统缓慢,多个客户端的内存溢出崩溃的问题. 打开了SQL Server Profiler(SQL Ser ...

  2. hdu 2069 1 5 10 25 50 这几种硬币 一共100个(母函数)

    题意: 有50 25 10 5 1 的硬币 一共最多有100枚 输入n输出有多少种表示方法 Sample Input1126 Sample Output413 # include <iostre ...

  3. 【LOJ】#2062. 「HAOI2016」地图

    题解 我对莫队真是一无所知 这个东西显然可以用圆方树转成一个dfs序列 然后呢,用莫队计算每个询问区间的每个数出现的次数,从而顺带计算每个数字的奇偶性 但是我们要查的数字也用一个范围,可以直接用分块维 ...

  4. 【POJ】1740.A New Stone Game

    题解 想去学习一下博弈论的SG函数 不过貌似这道题就是猜结论并且证明 题意是,随便选择一堆石子,扔掉至少一个,然后从扔石子的这堆里选择任意多(可以不选)放到其他任意多的未选择完的石堆里 一堆石子,先手 ...

  5. Bootstrap进阶七:LESS语法详解

    1.变量 2.混合 3.带参数混合 4.模式匹配和导引表达式 5.嵌套规则 6.运算 7.Color函数 8.Math函数 9.命名空间 10.作用域 11.注释 12.Importing 13.字符 ...

  6. ecshop用户中心菜单选项显示内容标签

    ecshop用户中心菜单选项有了,那肯定需要给相应的菜单选项添加内容,下面我们主要来讲下调用内容的标签,你也可以先访问一下用户中心菜单选项修改. 用户中心页面的内容分布在两个模板文件中:user_cl ...

  7. Ext.example.msg()应用

    ①需要在开发包中包含文件夹example/shared中的example.js和example.css两个文件即可. ②在html文件中引入: <script src="../extj ...

  8. tkinter-clock实例

    模仿着前辈的脚步,画了个临时的时钟显示: 代码如下: # coding:utf-8 from tkinter import * import math,time global List global ...

  9. luoguP4101 [HEOI2014]人人尽说江南好 结论

    题目大意: 给定\(n\)堆初始大小为\(1\)的石堆 每次选择两堆石子合并,特别的,合并之后的两堆石子不能\(> m\) 询问先手必赢? 不妨设我们是先手,且最后我们必胜 我们考虑构造局面\( ...

  10. [BZOJ4372]烁烁的游戏(动态点分治+线段树)

    和[BZOJ3730]震波几乎一样,每个点建两棵线段树分别代表它的管辖范围内以它为LCA的路径的贡献和它对父亲的贡献. 注意点分树上的点的距离在原树上不单调,所以不能有若距离超出限制就break之类的 ...