为富文本同时添加删除线和下划线
2017-09-06 本文已影响0人
alohasingle
NSDictionary *attrDict1 =@{NSStrikethroughStyleAttributeName:@(NSUnderlineStyleSingle),NSFontAttributeName: [UIFont systemFontOfSize:self.font.pointSize],NSBaselineOffsetAttributeName:@(0)};
NSMutableAttributedString * str = [[NSMutableAttributedString alloc]initWithString:self.textattributes: attrDict1];
NSDictionary * attrDict2 = @{NSUnderlineStyleAttributeName:@(NSUnderlineStyleSingle),NSFontAttributeName: [UIFontsystemFontOfSize:self.font.pointSize],NSBaselineOffsetAttributeName:@(0)};
[str addAttributes:attrDict2 range:NSMakeRange(0,self.text.length)];
self.attributedText= str;