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 中定义的绝大部分语法是不支持的。
  • 相关阅读:
    java高并发程序设计模式-并发级别:阻塞、无障碍、无锁、无等待【转载】
    Java创建线程的三种主要方式
    Java乐观锁实现之CAS操作
    Java解释执行和编译执行
    手把手教你使用百度大脑地址识别API
    详解百度大脑EdgeBoard出色的视频处理技术
    一步到位!!百度大脑语音合成快速搞定会员到访提醒功能
    一文带你了解百度大脑云狐语音全攻略(附代码)
    AI小程序之语音听写来了,十分钟掌握百度大脑语音听写全攻略!!
    快速上手百度大脑EasyDL专业版·物体检测模型(附代码)
  • 原文地址:https://www.cnblogs.com/YouXianMing/p/3669428.html
Copyright © 2011-2022 走看看