stu
stu

Reputation: 175

UIStackView not arranging sub views correctly

I have a UIStackView constrained within a basic UIView to fill the whole space. The stack view axis is vertical, the Alignment is Fill and the Distribution is Fill Equally.

I've added two container views and set their background colors to be red & green respectively.

Main Storyboard

All I want is for each subview to fill up half of the space vertically, but for whatever reason it keeps coming out like so:

Current Results

The container view mode is Scale To Fill.

Any ideas? Thanks a lot!

Upvotes: 1

Views: 844

Answers (1)

stu
stu

Reputation: 175

Aha, it was due to Size Classes. I was set to Compact when I created the view and the containers. When I switched back to the base size class (Any, Any), the UIStackView was greyed out. So I rebuilt it from scratch it now it works.

I hope this helps someone else!

Upvotes: 1

Related Questions