Reputation: 905
I would like to adjust the height of label in my app.
I set Number of Lines: 0 in Attribute Inspector. I made Trailing, Leading and Top constraints.
I would like to get label height adjustment. Can anyone help me please?
Upvotes: 0
Views: 3047
Reputation: 72410
What you can do is set that label's bottom
to the director's name label also set the greater than equal to (>=)
constraints for your label height, So it will looks like this.
Now set the constrains for the director's name label to leading
, trailing
and height
with greater than equal to (>=)
. Now also set the Director heading label top to this director's name label. So you are having constrains for this label like this.
Now simply select the Director heading label and set the fixed width height leading and trailing, Don't forgot to set its top to Director's name label. So the final result give you like this.
Note: Don't forgot to set numberOfLines
to 0
for both of your cast name label and director name label.
Upvotes: 3
Reputation: 3237
If you have given constraints to your label then you have to write it like,
self.lblText.numberOfLines = 0
self.lblText.lineBreakMode = .byWordWrapping
self.lblText.sizeToFit()
This adjust your label based on your text string.
Upvotes: 2