I am trying to render some text in background using [NSAttributedString drawWithRect:options:context:]
method and I'm passing (NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading| NSStringDrawingTruncatesLastVisibleLine | NSLineBreakByWordWrapping)
for the options. If my string is longer than two lines (I've calculated the max height of the rectangle for that) my text is truncated with ...
.
It works great, however, instead of ...
, I need to truncate with ...more
(with "more" at the end).
All the rendering must be done on background thread so any UI component is not possible. And please don't recommend TTTAttributedLabel
because I'm trying to get away from it in the first place as it resulted in terrible performance in scrolling in my app (already tried that).
How can I use a custom truncation token when drawing a string in background thread?