QCAttributedStringBuilder 2.0.0

QCAttributedStringBuilder 2.0.0

qingchuan维护。



  • 作者:
  • zxqqingchuan

QCAttributedStringBuilder

CI Status Version License Platform

示例

要运行示例项目,请克隆仓库,并首先在 Example 目录中运行 pod install

要求

特性

  • Builder 模式,支持链式调用。
  • 支持文字排版 RTL 模式。
  • 支持文字中嵌入 UIImageView、UIView、CALayer。
  • Attachment 依赖 YYText 实现。

示例

label.attributedText = QCAttributedString("abc")
    .color(.blue)
    .font(.systemFont(ofSize: 10))
    .alignment(.left)
    .append(", efg")
    .appendAttr(
        QCAttributedString(", emn")
            .color(.green)
            .build()
    )
    .firstSet(.red, of: "e")
    .firstReplace(
        "abc",
        with:
            QCAttributedString("cba")
            .color(.cyan)
            .font(.systemFont(ofSize: 20))
            .build()
    )
    .appendImage...
    .appendSpace...
    .appendRoundedLabel...
    .build()

安装

QCAttributedStringBuilder 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中:

pod 'QCAttributedStringBuilder'

作者

zxqqingchuan, [email protected]

许可证

QCAttributedStringBuilder可在MIT许可证下使用。有关更多信息,请参阅 LICENSE 文件。