0

I'm trying to create a grid using UIStackView, I'm able to do it expect for one problem. i can not make it a perfect square. whenever i set aspect ratio constraint i get conflicts constraints.

the grid is 5✕7

I'm embedding each row in a UIStackView, then all the rows in an outer UIStackView but it doesn't seem to work.

what is the best way to do it?

L A
  • 966
  • 11
  • 25
Ali Alebrahim
  • 617
  • 1
  • 9
  • 25

1 Answers1

2

Generally, the best way is to use as few constraints as possible. In this case, if your row stack views and the outer stack view are both set to fill equally then the only additional constraint should be to set the ratio of the outer stack view to 5:7. Obviously, you will also need some constraints for the overall size and position.

Westside
  • 675
  • 1
  • 7
  • 16