CCKit2
    Preparing search index...

    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.

    TypeScript
    innerView.addConstraints([
    new CCLayoutConstraint(innerView, CCLayoutConstraint.Attribute.Top, CCLayoutConstraint.Relation.Equal, this.view, CCLayoutConstraint.Attribute.Top, 1, 0),
    new CCLayoutConstraint(innerView, CCLayoutConstraint.Attribute.Left, CCLayoutConstraint.Relation.Equal, this.view, CCLayoutConstraint.Attribute.Left, 1, 1),
    new CCLayoutConstraint(innerView, CCLayoutConstraint.Attribute.Right, CCLayoutConstraint.Relation.Equal, this.view, CCLayoutConstraint.Attribute.Right, 1, 1),
    new CCLayoutConstraint(innerView, CCLayoutConstraint.Attribute.Height, CCLayoutConstraint.Relation.Equal, this.view, CCLayoutConstraint.Attribute.Height, 0.5, 0)
    ]);
    Lua
    innerView:addConstraints({
    LuaWrappers.new(CCLayoutConstraint, innerView, CCLayoutConstraint.Attribute.Top, CCLayoutConstraint.Relation.Equal, self.view, CCLayoutConstraint.Attribute.Top, 1, 0),
    LuaWrappers.new(CCLayoutConstraint, innerView, CCLayoutConstraint.Attribute.Left, CCLayoutConstraint.Relation.Equal, self.view, CCLayoutConstraint.Attribute.Left, 1, 1),
    LuaWrappers.new(CCLayoutConstraint, innerView, CCLayoutConstraint.Attribute.Right, CCLayoutConstraint.Relation.Equal, self.view, CCLayoutConstraint.Attribute.Right, 1, 1),
    LuaWrappers.new(CCLayoutConstraint, innerView, CCLayoutConstraint.Attribute.Height, CCLayoutConstraint.Relation.Equal, self.view, CCLayoutConstraint.Attribute.Height, 0.5, 0)
    })
    Index

    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: CCView | undefined

        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: CCView | undefined

    The second item to constrain to.

    Accessors