Height and vertical position are ambiguous for UIStackView

Autolayout cannot determine the height or vertical position of the UIStackView despite adding additional objects.

This is a fairly common mistake and gotcha, so see the answer below.

+3


source to share


2 answers


If it is for UIStackView make sure you are using addArrangedSubview

and not addSubview



+3


source


For me, I got the following error:

warning: Ambiguous Layout: Position and size are ambiguous for 'Button'.



If the button was placed inside a stack view in Interface Builder. The problem was that I checked Hidden in Interface Builder, which meant Xcode was freaking out saying position and size are ambiguous. Just uncheck the "Hidden" checkbox in Stack View and the warning disappears ... Magic! ✨

0


source







All Articles