小编kot*_*ska的帖子

具有删除线的多行属性字符串

我有一个标签:

label.numberOfLines = 0
Run Code Online (Sandbox Code Playgroud)

而我正在努力使这个标签的文字删除:

let index: NSMutableAttributedString = NSMutableAttributedString(string: label.text!)
index.addAttributes([NSStrikethroughStyleAttributeName: NSUnderlineStyle.styleSingle.rawValue, NSStrikethroughColorAttributeName: UIColor.red], range: NSMakeRange(0, index.length))
label.textColor = UIColor.red
label.attributedText = index
Run Code Online (Sandbox Code Playgroud)

属性字符串是否适用于多行或使用numberOfLines设置为0的标签?如果是这样,如何使多行文字删除?

nsattributedstring uilabel ios swift swift3

1
推荐指数
1
解决办法
1911
查看次数

标签 统计

ios ×1

nsattributedstring ×1

swift ×1

swift3 ×1

uilabel ×1