I have a view with an imageview in it. I'd like to be able to make it so that the imageview always remains a perfect square, but I am not entirely sure how to implement this with autolayout.
My screen looks like so currently:

The imageview is what I'd like to be square, no matter the width dimension. I understand that this may be able to be done with constraints, and I have tried, but ultimately have been unable to figure out how to achieve this. This is perhaps due to my relative inexperience with autolayout, storyboards and ios development in general
You should set 4 constraints for your square view: Top Spacing, Leading Spaces, Trailing Spaces and Aspect Ratio. This is shown bellow:
Make sure that the aspect ratio of your square is 1:1

Hope this helps and good luck with Auto Layout!
There is an aspect ratio constraint. You can set that to 1:1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With