小编Las*_*ann的帖子

在Swift中只有下划线的颜色

如何更改标签中下划线的颜色?我只希望下划线更改颜色,而不希望更改整个文本。

我已使用此代码来强调以下内容:

let underlineAttribute = [NSAttributedStringKey.underlineStyle: NSUnderlineStyle.styleSingle.rawValue]
let underlineAttributedString = NSAttributedString(string: "\(nearSavings[indexPath.row]) ,-", attributes: underlineAttribute)
cell.detailTextLabel?.attributedText = underlineAttributedString
Run Code Online (Sandbox Code Playgroud)

但是我找不到代码来设置下划线颜色。谁能帮忙?

label underline nsattributedstring swift

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

标签 统计

label ×1

nsattributedstring ×1

swift ×1

underline ×1