Instance Property

needsLayout

A Boolean value indicating whether the view needs a layout pass before it can be drawn.

Declaration

var needsLayout: Bool { get set }

Return Value

true if the view needs a layout pass, false otherwise.

Discussion

You only ever need to change the value of this property if your view implements the layout() method because it has custom layout that is not expressible in the constraint-based layout system. Setting this property to true lets the system know that the view’s layout needs to be updated before it is drawn. The system checks the value of this property prior to applying constraint-based layout rules for the view.

See Also

Triggering Auto Layout

func layout()

Perform layout in concert with the constraint-based layout system.

func layoutSubtreeIfNeeded()

Updates the layout of the receiving view and its subviews based on the current views and constraints.

var needsUpdateConstraints: Bool

A Boolean value indicating whether the view’s constraints need to be updated.

func updateConstraints()

Update constraints for the view.

func updateConstraintsForSubtreeIfNeeded()

Updates the constraints for the receiving view and its subviews.