- (void)setTextViewAttributedText
{
NSMutableAttributedString * mutStr = [self.contextLabel.attributedText mutableCopy];
NSString *string = self.contextLabel.text;
NSRange hostRange = [string rangeOfString:_model.hostTeamName];
//主队颜色
[mutStr addAttribute:NSForegroundColorAttributeName value:[UIColor orangeColor] range:hostRange];
NSRange guestRange = [string rangeOfString:_model.guestTeamName];
//客队颜色
[mutStr addAttribute:NSForegroundColorAttributeName value:[UIColor orangeColor] range:guestRange];
// NSString *timeStr = [_model showTime];
// NSRange timeRange = [string rangeOfString:[NSString stringWithFormat:@"时间为:%@", timeStr]];
// //字体
// [mutStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:12] range:timeRange];
// [mutStr addAttribute:NSForegroundColorAttributeName value:[UIColor grayColor] range:timeRange];
// //下划线
// [mutStr addAttribute:NSUnderlineStyleAttributeName value:@(NSUnderlineStyleSingle | NSUnderlinePatternDot) range:NSMakeRange(32, 8)];
// //空心字
// [mutStr addAttribute:NSStrokeWidthAttributeName value:@(2) range:NSMakeRange(42, 5)];
self.contextLabel.attributedText = [mutStr copy];
}
网友评论