Hello :) I study UIStackView views priority.
this picture is my current situation. I put greenBtn, redBtn, yellowBtn in stackView.
I also set each button size.
GreenBtn width = 100, height = 100.
RedBtn width = 200, height = 300.
YellowBtn width = 250, height = 100.
And now StackView's. Axis = Vertical, Alignment = Fill, Distribution = Fill.
And those has Conflicting Constraints about each width. I want stackView width equal yellow Btn's width.
So first, I tried to modify each Btn Content Hugging Priority.
GreenBtn CH(Content Hugging) Hori: 250 Verti: 250
RedBtn CH Hori: 249 Verti: 250
YellowBtn CH Hori: 248 Verti: 250
Not working,,,
So I also tried to change Compressing Resistance(CR) prioirty
GreenBtn CR Hori: 750 Verti: 750
RedBtn CR Hori: 751 Verti: 750
YellowBtn CR Hori: 752 Verti: 750
Still not work ... StackView's width = 100
Finally I tried to change each button's required Priority only. (each CHCR value setting defaultLow, defaultHigh)
GreenBtn width priority = 997
RedBtn width priority = 998
YellowBtn width priority = 999
and Now stackView's width has 250width( Yellow Btn width)
Question1. I wonder why doesn't changed stackView width when I changed CH value or CR value. what caused my settings to be wrong and how to fix it?
Question2. I wonder why changed when I change buttons required priority value?
If the required priority is the same as 1000, isn't CHCR applied differently depending on the priority value of CHCR? Is the required priority over .defaultLow and .defaultHigh value just the boss?
Thanks for reading the long question.



