首页 > 代码库 > 设置字符串中某些字符的特殊效果

设置字符串中某些字符的特殊效果

NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:self.title];
   
[attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor customBlueColor]range:NSMakeRange(1, 1)];

    
headlinelabel.attributedText = attributedString;
    
[headlinelabel sizeToFit];

设置字符串中某些字符的特殊效果