UILabel *label = [[UILabel alloc] init];
    label.text = @"UILabel多种字体";
    
    UIFont *font = [UIFont systemFontOfSize:14];
    UIColor *color = [UIColor redColor];
    NSRange range = NSMakeRange(0, 1);
    //设置不同字体颜色
    NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:label.text];
    //设置字体
    [attrStr addAttribute:NSFontAttributeName value:font range:range];
    //设置颜色
    [attrStr addAttribute:NSForegroundColorAttributeName value:color range:range];
    label.attributedText = attrStr;

 

 posted on 2016-08-24 18:30  孩子多了不好养  阅读(192)  评论(0编辑  收藏  举报