我NIAttributedLabel
用于在文本上显示链接。
NIAttributedLabel *label;
label = [[NIAttributedLabel alloc] initWithFrame:rect];
label.delegate = self;
label.font = [UIFont fontWithName:@"Helvetica" size:MAIN_FONT_SIZE];
label.textAlignment = UITextAlignmentLeft;
label.lineBreakMode = UILineBreakModeWordWrap;
label.numberOfLines = 0;
label.backgroundColor = [UIColor clearColor];
label.highlightedTextColor = [UIColor whiteColor];
label.text = strEditedText;
label.textColor = [UIColor blackColor];
[label setTextColor:[UIColor blueColor]
range:[strEditedText rangeOfString:stringPh]];
但是最后一行无法正常工作,尽管stringPh在strEditedText中。所有的文字都是蓝色的。