I need a UILabel subcass with multiline attributed text with support for links, bold styles, etc. I also need tail truncation with an ellipsis. None of the open source code that supports attributed text inside UILabels (TTTAttributedLabel
, OHAttributedLabel
, TTStyledTextLabel
) seem to support tail truncation for multi-line text. Is there an easy way to get this?
Maybe I'm missing something, but whats wrong with? :
NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithString:@"test"];
NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];
style.lineBreakMode = NSLineBreakByTruncatingTail;
[text addAttribute:NSParagraphStyleAttributeName
value:style
range:NSMakeRange(0, text.length)];
label.attributedText = text;
This works perfectly and will add a ellipsis to the end.