Using TTTAttributedLabel, with my code:
NSString *contentText = @"some text here foo bar";
[self.content setText:contentText afterInheritingLabelAttributesAndConfiguringWithBlock:^NSMutableAttributedString *(NSMutableAttributedString *mutableAttributedString) {
return mutableAttributedString;
}];
self.content.linkAttributes = @{ NSForegroundColorAttributeName: [UIColor redColor],
NSUnderlineStyleAttributeName: [NSNumber numberWithInt:NSUnderlineStyleSingle] };
NSRange range = [self.content.text rangeOfString:@"foo bar"];
[self.content addLinkToURL:[NSURL URLWithString:@"action://load-foo"] withRange:range];
[self.content setNeedsDisplay];
Everything works perfectly, in terms of tapping the range text and performing an action, however, the only thing that doesn't seem to work is the text colour. Am I using NSForegroundColorAttributeName
correctly with the lib?
EDIT:
By, "doesn't work", is that the underlined text stays grey, and not red like I've set it above.