-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
NSString * str1=@"我要改变文字的颜色";
NSString * str2=@"红色的文字";
NSDictionary * dic=@{NSForegroundColorAttributeName:[UIColor redColor]};
NSAttributedString * att=[[NSAttributedString alloc]initWithString:str2 attributes:dic];
NSMutableAttributedString * attstr=[[NSMutableAttributedString alloc]initWithString:str1];
[attstr appendAttributedString:att];
self.lable.attributedText=attstr;
}
效果如下图: