美文网首页
为富文本同时添加删除线和下划线

为富文本同时添加删除线和下划线

作者: alohasingle | 来源:发表于2017-09-06 12:10 被阅读0次
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;

相关文章

网友评论

      本文标题:为富文本同时添加删除线和下划线

      本文链接:https://www.haomeiwen.com/subject/rrwmjxtx.html