标签:解决 uilable uil nal baseline 中文 nsstring sdi eth
iOS10.3系统的一个Bug,在UILable中含有中文时,中划线会失效
NSString *priceStr = [NSString stringWithFormat:@"%.2f元",payInfo.originalPrice];
1、原来添加中划线方式(在iOS10.3系统后失效)
// NSDictionary *attribtDic = @{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle]};
// NSMutableAttributedString *attribtStr = [[NSMutableAttributedString alloc] initWithString:priceStr attributes:attribtDic];
2、解决办法
NSMutableAttributedString *attribtStr = [[NSMutableAttributedString alloc] initWithString:priceStr];
[attribtStr setAttributes:@{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle], NSBaselineOffsetAttributeName : @(NSUnderlineStyleSingle)} range:NSMakeRange(0, priceStr.length)];
self.originLable.attributedText = attribtStr;
标签:解决 uilable uil nal baseline 中文 nsstring sdi eth
原文地址:http://www.cnblogs.com/yang-shuai/p/6768222.html