zoukankan      html  css  js  c++  java
  • [翻译] 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>. 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 中定义的绝大部分语法是不支持的。
  • 相关阅读:
    实习第一天
    附加、分离数据库和备份、还原数据库的区别(转载于中雪的BLOG)
    2014-08-29 Last Day
    2014-08-26 解决HttpContext.Current.Session在ashx文件中出现“未将对象引用设置到对象的实例”的问题
    什么是Ajax? (转载于疯狂客的BLOG)
    Response.Expires 属性 (转载于疯狂客的BLOG)
    2014-08-22 关于Response、Request等对象在cs文件中的使用
    ASP.NET获取IP的6种方法(转载于LanceZhang's Tech Blog)
    2014-08-13 SQL语句之Left Join
    2014-08-07 优秀程序员所应具备的思想
  • 原文地址:https://www.cnblogs.com/YouXianMing/p/3669428.html
Copyright © 2011-2022 走看看