ios10.3+ ,UILabel的属性文字中间划线不显示情况

ios 10.3+ 系统,NSAttributedString 里设置 文字中间划线,只要含有汉字就会不显示中间线。目测是ios10.3+系统的bug。ios11和ios10.2 就没这个问题。

修改方法:添加设置 NSBaselineOffsetAttributeName:@(NSUnderlineStyleSingle)

例如:

1.NSAttributedString  *attrStr =

[[NSAttributedString alloc]initWithString:textStr attributes:

@{NSFontAttributeName:SYS_FONT(17),

NSForegroundColorAttributeName:RSQColorFromHex(0xa3a3a3),

NSStrikethroughStyleAttributeName:@(NSUnderlineStyleSingle),

NSStrikethroughColorAttributeName:RSQColorFromHex(0xa3a3a3),

NSBaselineOffsetAttributeName:@(NSUnderlineStyleSingle)

}];

你可能感兴趣的:(ios10.3+ ,UILabel的属性文字中间划线不显示情况)