Reputation: 2574
I have a text label which can contain text in length from a few words to a few paragraphs. I want it to behave something like a <p>
does in HTML. It is set up like this:
It is attached to the left ("Equals 18 pixels"), to the top ("Equals 31 pixels") and to the right ("Greater than or Equal").
The result looks like this:
You can see, that autolayout is right, all the constraints are fulfilled, but it is not what I wanted. It somehow misses an equalation which tells the value label to fill the maximum space horizontally it can fill. How can I set this up using Storyboards?
Upvotes: 4
Views: 6510
Reputation: 3635
This should to the trick:
UILabel
to the desired width.UILabel
and use the Editor
> Pin
> Trailing Space to Superview
menu option.Upvotes: 4
Reputation: 524
Select your UILabel and then in Editor
menu select Size to Fit content
Also remove the right constraint ("Greater than or Equal").
Doing this, your label will stretch horizontally to fit its content. This will solve your problem.. :)
Upvotes: 0