标签:label文字颜色
NSString *contentSrt = [NSString stringWithFormat:@"%@ (%@)",categoryModel.categoryName, categoryModel.phoneCount]; NSRange rang = [contentSrt rangeOfString:categoryModel.categoryName]; NSMutableAttributedString *attStr = [[NSMutableAttributedString alloc]initWithString:contentSrt]; [attStr addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:53.0/255.0 green:53.0/255.0 blue:53.0/255.0 alpha:1.0] range:NSMakeRange(0, contentSrt.length)]; NSRange lightRang = NSMakeRange(rang.length, contentSrt.length - rang.length); [attStr addAttribute:NSForegroundColorAttributeName value:[UIColor themeLightGrayColor] range:lightRang]; contentLabel.attributedText = attStr; contentLabel.highlightedTextColor = [UIColor whiteColor];
标签:label文字颜色
原文地址:http://blog.csdn.net/u012889435/article/details/46678707