NSLayoutConstraint

class NSLayoutConstraint : NSObject
  • Construct instance of NSLayoutConstraint with priority set

    See UIKit NSLayoutConstraint for further details

    Declaration

    Swift

    public convenience init(item: Any,
        attribute attr1: LayoutAttribute,
        relatedBy: LayoutRelation,
        toItem: Any?,
        attribute attr2: LayoutAttribute,
        multiplier: CGFloat,
        constant: CGFloat,
        priority: Constraid.LayoutPriority)

    Parameters

    item

    The item you want to constrain

    attr1

    The attribute of item to constrain

    relatedBy

    relation ship to use to constrain item‘s attr1 to toItem’s attr2

    toItem

    The item you want to constrain item to

    attr2

    The attribute of the toItem to constrain

    mutiplier

    The ratio altering the constraint relative to toItem’s attr2 in the constraint equation

    constant

    The constant in the constraint equation

    priority

    The priority this constraint uses when being evaluated against other constraints

    Return Value

    the constructed NSLayoutConstraint