我有一个字符串...。Share Pictures
我想以Share
不同的颜色显示。我曾经NSMutableAttributedString
更改字符串那部分的颜色。但是当我cell.textLabel.text
使用以下字符串设置它时它不起作用。任何其他方式做这个?
这种方式是行不通的。
NSMutableAttributedString *string3 = [[NSMutableAttributedString alloc]initWithString:@"Share pictures "];
[string3 addAttribute:NSForegroundColorAttributeName value:[UIColor orangeColor] range:NSMakeRange(0, 4)];
NSString *tempStr3 = @"with your friends.";
NSString *finalString3 = [NSString stringWithFormat:@"%@%@" , string3, tempStr3];
[menuTextArray addObject:finalString3];
并在表视图数据源方法中。
cell.textLabel.text = [menuTextArray objectAtIndex:indexPath.row];