I am using Xcode 9 Beta 6, and following a Devslopes tutorial. In the tutorial we are putting two images in a horizontal stack view, and setting it to Fill Equally. Also on one of the images we are putting two constraints, Width <= 140 and aspect-ratio 1:1. When I go to add new constraints and pin the stack view 8 to the left and right, and 24 to the top the view gets extremely large and goes off of the phone and pushes other items with it. I'm not sure why this is happening.
Asked
Active
Viewed 202 times
0
-
What exactly are you trying to achieve using these constraints? I mean what kind of UI? – PGDev Sep 10 '17 at 14:41
-
I have updated above to show the finished mockup. – Andy Becker Sep 10 '17 at 15:41
1 Answers
0
I've duplicated your issue, and what I have found is that your constraint where you are setting width on your Data Image <= 140 seems to be the issue. You are setting your stack view to fill equally. This is a conflict. How can one image be <= 140, while you are filling equally? I'm fairly certain this is the cause of your problem.
In the image below, I've set my Stack View to fill, pinned it left and right at 8 and set the image on the left to 140 and it works fine. In Attributes Inspector, set the Spacing Attribute on the Stack View to get the space between images as you desire.

Martin Muldoon
- 3,388
- 4
- 24
- 55