解決 Label 富文本刪除線¥100 不水平 (斷層) 問題

添加刪除線:
NSMutableAttributedString * discount = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"¥%@",discountStr] attributes:
@{NSFontAttributeName : [UIFont jk_systemFontOfPxSize:30],
NSForegroundColorAttributeName : JKSameRGBColor(153),
NSStrikethroughStyleAttributeName:@(NSUnderlineStyleDouble),
NSStrikethroughColorAttributeName : [UIColor yellowColor]

其中:NSStrikethroughStyleAttributeName 刪除線

實際上,設置刪除線 NSStrikethroughColorAttributeName 的時候,值也是這個枚舉。

// NSUnderlineStyleNone 不設置下劃線/刪除線

// NSUnderlineStyleSingle 設置下劃線/刪除線為細的單線

// NSUnderlineStyleThick 設置下劃線/刪除線為粗的單線

// NSUnderlineStyleDouble 設置下劃線/刪除線為細的雙線

// NSUnderlinePatternSolid 設置下劃線/刪除線樣式為連續(xù)的實線
//NSUnderlinePatternDot 設置下劃線/刪除線樣式為點,也就是虛線,比如這樣:------

// NSUnderlinePatterDash 設置下劃線/刪除線樣式為破折號,比如這樣:—— —— ——

// NSUnderlinePatternDashDot 設置下劃線/刪除線樣式為連續(xù)的破折號和點,比如這樣:——-——-——-

// NSUnderlinePatternDashDotDot 設置下劃線/刪除線樣式為連續(xù)的破折號、點、點,比如:——--——--——--

// NSUnderlineByWord 在有空格的地方不設置下劃線/刪除線

當 : ¥ 和 100 組合 時 ,刪除線出現(xiàn)斷層,不水平現(xiàn)象

圖:
image.png

當我用$符號時,發(fā)現(xiàn)沒問題,所以我猜測是 中英文 結合問題

解決:
image.png

上面的是 直接 快捷鍵shift + 4 打得 符號,有斷層
下面是 用 搜狗 打“RMB”選的符號,沒有斷層


image.png
?著作權歸作者所有,轉載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容