常用到的屬性字元串 直接賦給label就可以了 ...
常用到的屬性字元串
///定義屬性字元串
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就可以了