I am having a problem resizing the font size to fit a label and not splitting any words. I have a label that will change its content dynamically based on an array of strings. The label could have any number of lines. What I want is for the font size to be as big as possible while fitting the label AND not splitting any words. I made the font size very big on storyboard. The label is placed on the view using Auto-Layout.
For example for a string "Most definitely" if I use this code:
answerLabel.numberOfLines = 0
answerLabel.adjustsFontSizeToFitWidth = true
answerLabel.lineBreakMode = .byTruncatingTail
I get strings like: Most(line 1) Definitel(line 2) y(line 3)
If on the other hand I do
answerLabel.numberOfLines = 0
answerLabel.adjustsFontSizeToFitWidth = true
answerLabel.lineBreakMode = .byWordWrapping
I get a string "Mo" in big letters
Obviously what I am looking for in that case is Most(line 1) definitely(line 2).
Thanks in advance for any help.