如何更改标签中下划线的颜色?我只希望下划线更改颜色,而不希望更改整个文本。
我已使用此代码来强调以下内容:
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)
但是我找不到代码来设置下划线颜色。谁能帮忙?