Resize the UILabel or font to match the Accented character

I have a UILabel with text inside it:

self.textLabel; 

Now I noticed that whenever I added an accented letter like Ä Ö Ü, I get an effect such as:

enter image description here

Note that the high points on the drum letters are disabled. I want the text to match the label, however, a restriction self.textLabel.numberOfLines = 2that ensures that I have 2 lines, and the text after the sentence goes beyond the width, is preserved. Essentially, I need a shortcut:

enter image description here

When saving points. Now I tried:

[self.frame sizeToFit]which does not work because it wraps around the entire text. As I said, cut the text after two lines.

Using .boundsand CGRectMaketo create new frames, then assign their new height to the current frame, which also does not work. See https://stackoverflow.com/questions/21948714/adjust-size-of-uilabel-to-fit-height-of-text for more details . Can someone please help me with this?

+3
source share
1 answer

The answer was to do

self.textLabel.numberOfLines = 2;

And then do:

[self.textLabel sizeToFit];
0
source

All Articles