NSString *str = @"We’ll notify you before we make changes to these
terms and give you the opportunity to review and comment on the revised
terms before continuing to use. If you have any question just email
me.";
NSMutableAttributedString *aStr = [[NSMutableAttributedString
alloc]initWithString:str attributes:nil];
[str rangeOfString:@"email"]];
[self.textView setAttributedText:aStr];
答案 0 :(得分:2)
NSString *str = @"We’ll notify you before we make changes to these terms and give you the opportunity to review and comment on the revised terms before continuing to use. If you have any question just email me.";
NSMutableAttributedString *aStr = [[NSMutableAttributedString alloc]initWithString:str attributes:nil];
[aStr addAttribute:NSLinkAttributeName value:@"Your Link here" range:[str rangeOfString:@"email"]];
[self.textView setAttributedText:aStr];
<强>更新强>
您可以添加字体属性以使其变为粗体。例如,如果您想使We’ll notify
加粗,那么
[aStr addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:14.0] range:[str rangeOfString:@"We’ll notify"]];
在将属性文字设置为textView
之前添加此行!