NSString *contentStr = @"aaaa,bbbb and cccc";
- (NSMutableAttributedString *)attributedMethods:(NSString *)textString withColor:(UIColor *)color withFontSize:(UIFont *)font withLineSpace:(CGFloat)lineSpace withUnderLineColor:(UIColor *)underLineColor{
NSInteger strLength=textString.length;
NSMutableAttributedString *attributedString=[[NSMutableAttributedString alloc] initWithString:textString];
[attributedString addAttribute:NSForegroundColorAttributeName value:color range:NSMakeRange(0, strLength)];
[attributedString addAttribute:NSFontAttributeName value:font range:NSMakeRange(0, strLength)];
NSMutableParagraphStyle *paragraphStyle=[[NSMutableParagraphStyle alloc] init];
[paragraphStyle setLineSpacing:lineSpace];
[attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, strLength)];
// 设置下划线
[attributedString addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:NSMakeRange(0, 14)];
[attributedString addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:NSMakeRange(14, 17)];
[attributedString addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:NSMakeRange(strLength-18, 18)];
[attributedString addAttribute:NSUnderlineColorAttributeName value:underLineColor range:NSMakeRange(0, strLength)];
[attributedString addAttribute:NSLinkAttributeName value:@"http://www.baidu.com" range:[[attributedString string] rangeOfString:@"Privacy Policy"]];
[attributedString addAttribute:NSLinkAttributeName value:@"http://www.baidu.com" range:[[attributedString string] rangeOfString:@"Terms of Service"]];
[attributedString addAttribute:NSLinkAttributeName value:@"http://www.baidu.com" range:[[attributedString string] rangeOfString:@"Subscription Terms"]];
return attributedString;
}