iOS 10.3 后NSUnderlineStyleSingle

2017-10-13  本文已影响10人  MeteorCode
NSMutableAttributedString *str1 = [[NSMutableAttributedString alloc] initWithString:frontStr

attributes:@{

   NSStrikethroughStyleAttributeName : @(NSUnderlineStyleSingle)

}];

这种写法,是给字符串上一条划线,但在iOS10.3设备上,划线没有显示出来;

解决:

在attrbutes里加多一个属性设置 :

NSBaselineOffsetAttributeName : @(0)

即:

NSMutableAttributedString *str1 = [[NSMutableAttributedString alloc] initWithString:frontStr

attributes:@{

   NSStrikethroughStyleAttributeName : @(NSUnderlineStyleSingle)
   NSBaselineOffsetAttributeName : @(0)

}];
上一篇 下一篇

猜你喜欢

热点阅读