Class CCLayoutConstraint

The CCLayoutConstraint class defines a rule that constrains a value of one view's geometry to another view, following a linear equation. Use constraints to make a UI that automatically handles resizing.

Constructors

  • Creates a new constraint between two views.

    Parameters

    • item1: CCView

      The first item to constrain

    • attribute1: Attribute

      The attribute of the first item to constrain

    • relation: Relation

      The relation between the two attributes

    • item2: undefined | CCView

      The second item to constrain to

    • attribute2: Attribute

      The attribute of the second item to constrain to

    • multiplier: number

      The multiplier to apply to the second attribute

    • constant: number

      The constant to add to the second attribute

    Returns CCLayoutConstraint

Properties

constant: number

The constant to add to the second attribute.

firstAttribute: Attribute

The attribute of the first item to use.

firstItem: CCView

The first item to constrain.

multiplier: number

The multiplier to apply to the second attribute.

priority: number = 1000

The priority of the constraint.

relation: Relation

The relation between the two attributes.

secondAttribute: Attribute

The attribute of the second item to use.

secondItem: undefined | CCView

The second item to constrain to.

Accessors