iOS10.3系统富文本删除线无法显示

che*_*nbo 2 ios nsmutableattributedstring ios10.3

Apple最近发布的iOS 10.3版本,使用前NSMutableAttributedString设置的前锋不显示

    [attributedString addAttribute:NSStrikethroughStyleAttributeName value:@(NSUnderlineStyleSingle | NSUnderlinePatternSolid) range:NSMakeRange(length1 + 7, length2 + 5)];
Run Code Online (Sandbox Code Playgroud)

尝试了很多方法都没有解决,希望能得到大家的帮助

Piy*_*ush 5

iOS 10.3以后你应该再添加一个属性.

[attributedString addAttribute:NSBaselineOffsetAttributeName value:@0 range:NSMakeRange(length1 + 7, length2 + 5)];

[attributedString addAttribute:NSStrikethroughStyleAttributeName value:@(NSUnderlineStyleSingle | NSUnderlinePatternSolid) range:NSMakeRange(length1 + 7, length2 + 5)];
Run Code Online (Sandbox Code Playgroud)