0

I notice that when a TTTableStyledTextItem is added to a table, the height is automatically set to 4 lines, even when there is more text. I tried simply subclassing TTTableStyledTextItemCell and setting the height, but this only increases the height of the cell and doesn't buy you more text inside of it. Subclassing various items (not cells) hasn't worked either as I'm unable to get the styled text to even show up when I do this.

Has anyone been successful in showing long styled text inside of a table?

This answer seems to imply there's a way to do it, but I can't grok the explicit way.

Thanks!

Community
  • 1
  • 1
Andrew Flynn
  • 1,501
  • 12
  • 17

1 Answers1

0

Answering my own question:

So it turns out that having non-breaking space in the text was causing it to stop after 4 lines. After I did a string replace on this in the text, using a TTTableStyledTextItem was no problem and correctly expanded to the number of lines.

So in the end looked something like this:

NSMutableString *temp = [NSMutableString stringWithString:textToDisplay];
[temp replaceOccurrencesOfString:@" " withString:@" " options:NSLiteralSearch range:NSMakeRange(0, [temp length])];
TTTableStyledTextItem *newItem = [TTTableStyledTextItem itemWithText:[TTStyledText textFromXHTML:[NSString stringWithString:temp]]];

Hopefully there aren't any other character bombs that I encounter

Andrew Flynn
  • 1,501
  • 12
  • 17