-1

I have this layout for my iphone app (image 1). Now what I want to do is add a constraint to second stack view such that my stack view tree would look like image 2. Now the problem is that whenever i try to add the constraint by clicking on the bottom bar of UI designer in XCode, it does add the constraint but then i see conflicts with parents constraints and hence XCode ask me to remove either 1 or multiple constraints. How can i add this constraint successfully?

(Sorry i don't know the UI Components name for XCode to refer them properly)

image 1

image 1

image 2

image 2

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Em Ae
  • 8,167
  • 27
  • 95
  • 162
  • Are you sure StackView is what you want here? Please read [documentation](https://developer.apple.com/reference/uikit/uistackview) to be sure. I didn't have the issue you described building your desired hierarchy. More details would be helpful. What parents constraints are conflicting? What constraints do you have for stack views? – Vlad Nov 21 '16 at 05:01
  • I am following Udemy NanoDegree tutorial where this is what i have asked to do. I have already spent time looking at their forums, documentation but nothing helped. The parent constraints are visible at the bottom of the first image. – Em Ae Nov 21 '16 at 05:06

1 Answers1

0

You probably forgot to change UIStackView's alignment property. If you have it set to fill StackView tries to stretch Button while you set its width to 64. That probably causes the conflicts. enter image description here

The same goes for the height. Make sure distribution property doesn't contradict with what you're setting manually.

Vlad
  • 245
  • 1
  • 10