常用到的属性字符串
///定义属性字符串
NSMutableAttributedString *att = [[NSMutableAttributedString alloc]initWithString:@""]; ///删除线 [att addAttribute:NSStrikethroughStyleAttributeName value:@(NSUnderlineStyleSingle | NSUnderlineStyleSingle) range:NSMakeRange(0, 0)]; ///字体大小 UIFont *font = [UIFont fontWithName:@"Helvetica-Bold" size:17.0]; [att addAttribute:NSFontAttributeName value:font range:NSMakeRange(0,0)]; ///字体颜色 [att addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(0, 0)]; // 下划线 [att addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:NSMakeRange(0, 0)];
直接赋给label就可以了