快速使用 TextAttributes 创建 NSAttributedString
let attributes = TextAttributes()
.font(UIFont.systemFontOfSize(14))
.alignment(.Center)
.foregroundColor(UIColor(white: 0.7, alpha: 1))
let attributedText = NSAttributedString(string: "Hello, NSAttributedText", attributes: attributes)
let attributedText = "Hello, NSAttributedText"
.attributed {
TextAttributes()
.font(UIFont.systemFontOfSize(14))
.alignment(.Center)
.foregroundColor(UIColor(white: 0.7, alpha: 1))
}
TextAttributesUtil 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中
pod "TextAttributesUtil"
muukii, [email protected]
TextAttributesUtil 在 MIT 许可下提供。有关更多信息,请参阅 LICENSE 文件。