ximmyxiao
ximmyxiao

Reputation: 2801

UIStackView change distribution from fill to fillEqually confusingly

enter image description here

As the picture :

  1. My Inner StackView (horizontal) set distribution to fill
  2. When you add two labels to this inner stackview , these two labels will got the same width . seems the distribution is set to fillEqually.

This is very confusing. And I can't found any material about why the UIStackView make this change .

Is this a undocumented feature or just a bug of UIStackView?

##########update############

seems a interface builder bug. After I reset all my xib contents ,and rebuild them again as before , this problem will not happen , and the ambiguous error will be generated as expeced

Upvotes: -1

Views: 56

Answers (1)

Mojtaba Hosseini
Mojtaba Hosseini

Reputation: 119108

They are filling the space equally because they have the same compression resistance and content hugging priorities. By assigning a higher priority to one, you'll see them fill their parent unequally, as you likely expected.

You can access these properties from the size inspector panel:

Demo

Upvotes: 0

Related Questions