NSMutableAttributedString *abs = [[NSMutableAttributedString alloc]initWithString:@"ABCDEFGHIGKLMN北京上海帝都魔都端午端午吃粽子"];
[abs beginEditing];
//字体大小
[abs addAttribute:NSFontAttributeName
value:[UIFont systemFontOfSize:20.0]
range:NSMakeRange(0, 2)];
//字体颜色
[abs addAttribute:NSForegroundColorAttributeName
value:[UIColor blueColor]
range:NSMakeRange(2, 2)];
//下划线
[abs addAttribute:NSUnderlineStyleAttributeName
value:@(NSUnderlineStyleSingle)
range:NSMakeRange(3, 7)];
//字体的设置
[abs addAttribute:NSFontAttributeName
value:[UIFont fontWithName:@"AppleGothic" size:24]
range:NSMakeRange(2, 6)];
//删除线
[abs addAttribute:NSStrikethroughStyleAttributeName value:@(NSUnderlinePatternSolid | NSUnderlineStyleSingle) range:NSMakeRange(10, 7)];
//删除线的颜色依附于删除线
[abs addAttribute:NSStrikethroughColorAttributeName value:[UIColor redColor] range:NSMakeRange(10, 7)];
//_showLabel 是之前定义好的UILabel
_showLabel.attributedText = abs;
_showLabel.numberOfLines = 0