Reputation: 20140
I'm using auto layout, I have a label which is not adjusting its width when the device orientation is changing.
Label in the Landscape mode:
Label in the Portrait mode:
Label in design mode with constraints:
On the label, the following constraints exists:
As you can see, the Portrait mode is ok, the problem is that when the orientation changes to landscape mode, the label remains how it is and does not adjust, why is that so? Am I missing any constraint?
Upvotes: 0
Views: 1123
Reputation: 3207
You need to add height constraint along with constant great than equal to label. As in image below.
I tried this with a demo and worked as shown.
Also I applid following constraints to UILabel.So no need to applied width constraint. Just height constraint did it !
Here check below up down left and right constraint I applied and also height I ticked then I clicked width in IB where I changed the constant to >= and also I didn't ticked width. remove all constraint apply only below.
Upvotes: 0