NSAttributedString *attrStr = [[NSAttributedString alloc]initWithString:str attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:size],
NSForegroundColorAttributeName:color,
NSStrikethroughStyleAttributeName:@(NSUnderlineStyleSingle),
NSStrikethroughColorAttributeName:[UIColor blackColor],
NSBaselineOffsetAttributeName : @(NSUnderlineStyleSingle) }];
// NSBaselineOffsetAttributeName : @(NSUnderlineStyleSingle) 10.3之后需要添加上,不添加->删除线等对中文无效
本文介绍如何使用NSAttributedString为文本设置包括字体大小、颜色、删除线样式及颜色等属性,并特别提到iOS 10.3版本后对中文字符的支持情况。

被折叠的 条评论
为什么被折叠?



