更改UILabel的字体样式及某段文字中的颜色

    NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:content];

    [str addAttribute:NSForegroundColorAttributeName value:WEIXINSYSTEM_COLOR range:range1];

    

    [str addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"Arial-BoldItalicMT" size:10.0] range:NSMakeRange(0, 5)];

    [str addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"HelveticaNeue-Bold" size:10.0] range:NSMakeRange(6, 12)];

    [str addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"Courier-BoldOblique" size:10.0] range:NSMakeRange(19, 6)];

   

    cell.awardCount_attLabel.attributedText = str;

你可能感兴趣的:(IOS,项目学习经验)