Instance Property

hasAmbiguousLayout

A Boolean value indicating whether the constraints impacting the layout of the view incompletely specify the location of the view.

Declaration

var hasAmbiguousLayout: Bool { get }

Discussion

The value of this property is true when the view’s location or size cannot be determined definitively based on the current constraints.

Accessing this property engages the layout engine to determine whether any other frame would also satisfy the constraints on the view. Because this process involves laying out the view, accessing the property can be an expensive operation but it can also provide useful debugging information. AppKit automatically calls this method when a window is asked to visualize its constraints using the visualizeConstraints(_:) method.

See Also

Debugging Auto Layout

func constraintsAffectingLayout(for: NSLayoutConstraint.Orientation) -> [NSLayoutConstraint]

Returns the constraints impacting the layout of the view for a given orientation.

func exerciseAmbiguityInLayout()

Randomly changes the frame of a view with an ambiguous layout between the different valid values.