标签文字的特殊设置

35 阅读1分钟

NSString *limitedStr = @"March 31,2018.";

        NSString *labelStr = @"All the limited-time free features will end on March 31,2018.";

        NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:labelStr];

        NSRange strRange = [labelStr rangeOfString:limitedStr];

      //设置标签文字属性                                          

       

 [attributedStringsetAttributes:[NSMutableDictionarydictionaryWithObjectsAndKeys:UIColorFromHex(0x0080e8),               NSForegroundColorAttributeName,nil] range:strRange];