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 中定义的绝大部分语法是不支持的。
  • 相关阅读:
    iconfont 引入后没有显示
    使用element-ui库时浏览器出现异常汉字(代码里找不到该汉字)
    ElementUI select 把整个option(对象)作为值
    不让浏览器history后退前进
    从IE浏览器链接跳转到谷歌浏览器方法
    mddir 可以生成项目工程结构
    Element-UI select 新加全部与多选互斥选择
    H5 video 常用属性
    a链接跳转报错 status为 canceled的解决办法
    学习计划与记录
  • 原文地址:https://www.cnblogs.com/YouXianMing/p/3669428.html
Copyright © 2011-2022 走看看