[英]How to apply color for underline style in NSAttributedString (ios)?
假設我要在NSAttributedString中添加下划線樣式:
[attrStr addAttribute:NSUnderlineStyleAttributeName value:@(NSUnderlineStyleSingle) range:range];
是否可以將顏色(不僅是下划線樣式)應用於下划線而不更改文本顏色?
是。 使用NSUnderlineColorAttributeName
設置下划線顏色。
[attrStr addAttribute:NSUnderlineColorAttributeName value:[UIColor redColor] range:range];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.