Stanislav Putilov
Stanislav Putilov

Reputation: 185

Constraints for labels with changing size

Pic. 1

enter image description here

Pic. 2

enter image description here

Pic.1 - it is a structure of my ViewController. Label1 and Label2 have changing size (content comes from backend) for different users. If content of labels is small, I need to set Top Space constraint for TableView (vertical spacing) to Button (pic.1), but if content of labels is big, set Top Space constraint for TableView (vertical spacing) to Stack (pic.2). How to set constraints for TableView?

Upvotes: 0

Views: 68

Answers (1)

Johnykutty
Johnykutty

Reputation: 12829

Embed your image,button two labels and stack in a view. Then add following constraints

  1. Top, leading and trailing to new container view
  2. vertical space b/w container and table.
  3. Required constraints for your image,button two labels and stack
  4. Don't add bottom constraint for button.
  5. Add bottom spacing to stack to its superview(embedded container) with a >=.
  6. Height to container view with minimum height and set priority to low(250)

enter image description here enter image description here

Upvotes: 1

Related Questions