-1

I'm having 2 views in Horizontal Stack View and the Distribution Style of that is Fill Proportionally. If One view set hidden as TRUE another view occupies all the space but when both the views are appearing Stack View is giving them a equal width instead giving proportional width. But where to specify the width proportions for the Stack View.

Vinoth
  • 119
  • 1
  • 6

2 Answers2

0

Before giving a width of the subviews, we have to set the Intrinsic Size for the subviews. If so you will get your result.

Vinoth
  • 119
  • 1
  • 6
0

UIStackView works purely on Autolayout, setting their frames or frames for their subviews wont work. Simplest way is to use Anchors.

[self.subViews.widthAnchor constraintEqualToConstant:50.0].active = YES;

Then the stackView will adjust itself accordingly.