4

I have a UITextView with strings that could be any length.

The size of the UITextView is fixed and if the string doesn't fit it needs to be truncated. I'm currently setting

self.titleTextView.textContainer.lineBreakMode = NSLineBreakByTruncatingTail;

However this will break mid word.

What I'm after is for words to be preserved but an elipsis needs to be appended.

For example:

"This string needs truncating"

would end up being

"This string needs trun..." 

if I use NSLineBreakByTruncatingTail when what I need is

"This string needs..."

What is the best way of achieving this style of truncation?

James
  • 41
  • 3

0 Answers0