IOS UILabel 中 颜色混排

UILabel* colorLabel = [[UILabelalloc]init];

colorLabel.frame=CGRectMake(0,100,200,100);

colorLabel.textColor= [UIColorblackColor];

NSMutableAttributedString*colorStr = [[NSMutableAttributedStringalloc]initWithString:@"在哪里呀蛤蛤蛤拉风的"];

NSRangeredRange = [[colorStrstring]rangeOfString:@"哪里呀"];

[colorStraddAttribute:NSForegroundColorAttributeNamevalue:[UIColorredColor]range:redRange];

[colorLabelsetAttributedText:colorStr];

[colorLabelsizeToFit];

你可能感兴趣的:(IOS UILabel 中 颜色混排)