I have a UILabel already with its line break mode setted to truncate tail. The problem is that I have a string that has no line breaks.
Is there an easy way that the UILabel adds break lines to the string??
Example:
“This is a long string that fits in 2 lines” –adding break lines–>
“This is a long string \nthat fits in 2 lines”
Or do I have to make a function that calculates, given a width and break mode, where to insert break lines?
Thanks!
I think that the best answer is that you shouldn’t be taking care of break lines. Just give the text to UILabel and it will break it correctly according to its break line mode.
The important thing is to remember that UILabel won’t resize it self. You have to increase its height if necessary and then assign the text. Or do both things overriding the setText: method.