同一个label内设置不用字体和颜色

如何这一个label实现不一样字体颜色,而不用多个label来实现字体

如 篮球39spa

// 距品牌上线差 3d

    NSString *str = [NSString stringWithFormat:@"距品牌上线差%@",@"255"];orm

    NSMutableAttributedString *attriStr = [[NSMutableAttributedString alloc] initWithString:str];string

    [attriStr addAttribute:NSForegroundColorAttributeName value:kRgb(251, 80, 81, 1) range:NSMakeRange(6,3)];it

    [attriStr addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"HelveticaNeue" size:11] range:NSMakeRange(6, 3)];table

    yourLabel.attributedText = attriStr;margin

相关文章
相关标签/搜索