要运行示例项目,请克隆仓库,并首先在 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 文件。