Reputation: 326
Kinda new to this whole auto layout constraints part. My app is closing up on a beta and i'm having trouble getting the constraints right. In the picture below i have succesfully managed to add the following constraints to each object
As you can see in the picture this behaviour results in fine layout for Iphone 6 and larger but when running on a Iphone 5 simulator or Iphone 4 preview, the layout is bad.
What can i do to achieve the same layout behaviour on smaller devices, so that my labels and img does not crop??
Thank you, in advance!
Upvotes: 0
Views: 1446
Reputation: 6982
For each label, keep the horizontal center constraint, but remove the leading and trailing (left and right) constraints. The label will then automatically resize to fit the content's width.
Upvotes: 1
Reputation: 25261
All you need to do is to make your labels have same width with you view controller and then make sure text shows up in center, like this
With this, you are making sure that the text can be centered and be as long as possible. If in this case your label still cannot fully show up, you will need to shrink it. Like calling
yourLabel.adjustsFontSizeToFitWidth = true
Upvotes: 1