UILabel truncate text not working

ios, objective-c, uilabel

Solution

If you're using attributed string and having set paragraph style to the attributed string: make sure you're passing `paragraphStyle.lineBreakMode = .byTruncatingTail`.

Problem

I set the numberOfLines to 1 in the IB, but when I set the text to a long string, it doesn't truncate. If I set the numberOfLines to 2, the truncate works fine.What should I do to truncate a long string into a single line?

Original source

Related problems