1

I have the following layout:

enter image description here

There are no height constraints on any of the views. Background Image View is pinned to the top, bottom and leading edges of the container. All the vertical compression and hugging priorities are left as default.

I am having the issue that the Container's height is determined by the height of the image. I want it to ignore the height of the image and use the height determined by the stack views and labels. How can I achieve this?

I have tried changing the compression resistance policy to the lowest value on the image view and this didn't make any difference.

Kex
  • 8,023
  • 9
  • 56
  • 129

2 Answers2

0

One of the following solutions can solve your problem.

  1. If they are vertically aligned, you can add "equal height" constraint from container to stackView.

  2. If they are horizontally aligned, you can add "top" and "bottom" constraints from container to stackView.

Dogan Altinbas
  • 268
  • 2
  • 11
0

top, left, right, bottom of imageView and stackView both equals to container. Then change the content hugging priority and content compression resistance priority as:

For more information about these values: https://medium.com/@abhimuralidharan/ios-content-hugging-and-content-compression-resistance-priorities-476fb5828ef

enter image description here

nghiahoang
  • 538
  • 4
  • 10