I have a view containing a container (gray) that contains a UILabel (blue).

I have layout restrictions, so the View container is always 8 pixels larger than the label on each side, and the borders of the left / top / right container are fixed. The view of the container is stretched accordingly when the orientation of the device changes.
The labelOfLines value is 0. I set the label text in the code. The height of the label increases to fit the text as expected.
Here's the problem: when I rotate the device to landscape, the width of the shortcut increases to fit the width of the screen, and the text fits on 2 lines. But UILabel does not compress its height to fit snugly against the text. Pay attention to the extra space above and below the text on the label.

So, how can I reduce the height of the shortcut when the device is rotated to fit snugly on the text?
I tried calling [myLabel sizeToFit] in the viewWill/DidLayoutSubviews , but this did not have a visible effect.
source share