NSLayoutConstraint.Create Method

Definition

Overloads

Create(NSObject, NSLayoutAttribute, NSLayoutRelation)

Factory method to create a constraint based on a UIView, an NSLayoutAttribute, and an NSLayoutRelation.

public static UIKit.NSLayoutConstraint Create(Foundation.NSObject view1, UIKit.NSLayoutAttribute attribute1, UIKit.NSLayoutRelation relation);
static member Create : Foundation.NSObject * UIKit.NSLayoutAttribute * UIKit.NSLayoutRelation -> UIKit.NSLayoutConstraint

Parameters

view1
NSObject

The view or object in the constraint.

attribute1
NSLayoutAttribute

The attribute for the view.

relation
NSLayoutRelation

The relationship in the constraint.

Returns

A new constraint with the specified parameters and default multiplier (1.0) and constant (0.0).

Remarks

Creates a constraint for a single view with default multiplier and constant values.

Applies to

Create(NSObject, NSLayoutAttribute, NSLayoutRelation, NFloat, NFloat)

Factory method for creating a constraint.

public static UIKit.NSLayoutConstraint Create(Foundation.NSObject view1, UIKit.NSLayoutAttribute attribute1, UIKit.NSLayoutRelation relation, System.Runtime.InteropServices.NFloat multiplier, System.Runtime.InteropServices.NFloat constant);
static member Create : Foundation.NSObject * UIKit.NSLayoutAttribute * UIKit.NSLayoutRelation * System.Runtime.InteropServices.NFloat * System.Runtime.InteropServices.NFloat -> UIKit.NSLayoutConstraint

Parameters

view1
NSObject

The view or object in the constraint.

attribute1
NSLayoutAttribute

The attribute for the view.

relation
NSLayoutRelation

The relationship in the constraint.

multiplier
NFloat

The multiplier applied to the attribute.

constant
NFloat

The constant value in the constraint.

Returns

A new constraint with the specified parameters.

Remarks

Creates a constraint for a single view with a specified attribute, relation, multiplier, and constant value.

Applies to

Create(NSObject, NSLayoutAttribute, NSLayoutRelation, NSObject, NSLayoutAttribute, NFloat, NFloat)

Factory method for creating a constraint.

public static UIKit.NSLayoutConstraint Create(Foundation.NSObject view1, UIKit.NSLayoutAttribute attribute1, UIKit.NSLayoutRelation relation, Foundation.NSObject view2, UIKit.NSLayoutAttribute attribute2, System.Runtime.InteropServices.NFloat multiplier, System.Runtime.InteropServices.NFloat constant);
public static UIKit.NSLayoutConstraint Create(Foundation.NSObject view1, UIKit.NSLayoutAttribute attribute1, UIKit.NSLayoutRelation relation, Foundation.NSObject? view2, UIKit.NSLayoutAttribute attribute2, System.Runtime.InteropServices.NFloat multiplier, System.Runtime.InteropServices.NFloat constant);
static member Create : Foundation.NSObject * UIKit.NSLayoutAttribute * UIKit.NSLayoutRelation * Foundation.NSObject * UIKit.NSLayoutAttribute * System.Runtime.InteropServices.NFloat * System.Runtime.InteropServices.NFloat -> UIKit.NSLayoutConstraint

Parameters

view1
NSObject

First view in the constraint.

attribute1
NSLayoutAttribute

Attribute for the first view.

relation
NSLayoutRelation

Relationship between the view1 and the view2.

view2
NSObject

Second view in the constraint. This parameter can be null.

attribute2
NSLayoutAttribute

Attribute for the second view.

multiplier
NFloat

Multiplier applied to the second attribute.

constant
NFloat

Constant to add.

Returns

A new constraint with the specified parameters.

Remarks

Creates a constraint relationship between the view1 and the view2 that satisfies the following linear equation: attribute1 = multiplier x attribute2 + constant.

Applies to

Create(INativeObject, NSLayoutAttribute, NSLayoutRelation, INativeObject, NSLayoutAttribute, NFloat, NFloat)

Factory method for creating a constraint.

[Foundation.Export("constraintWithItem:attribute:relatedBy:toItem:attribute:multiplier:constant:")]
[ObjCRuntime.BindingImpl(ObjCRuntime.BindingImplOptions.GeneratedCode | ObjCRuntime.BindingImplOptions.Optimizable)]
public static UIKit.NSLayoutConstraint Create(ObjCRuntime.INativeObject view1, UIKit.NSLayoutAttribute attribute1, UIKit.NSLayoutRelation relation, ObjCRuntime.INativeObject? view2, UIKit.NSLayoutAttribute attribute2, System.Runtime.InteropServices.NFloat multiplier, System.Runtime.InteropServices.NFloat constant);
[<Foundation.Export("constraintWithItem:attribute:relatedBy:toItem:attribute:multiplier:constant:")>]
[<ObjCRuntime.BindingImpl(ObjCRuntime.BindingImplOptions.GeneratedCode | ObjCRuntime.BindingImplOptions.Optimizable)>]
static member Create : ObjCRuntime.INativeObject * UIKit.NSLayoutAttribute * UIKit.NSLayoutRelation * ObjCRuntime.INativeObject * UIKit.NSLayoutAttribute * System.Runtime.InteropServices.NFloat * System.Runtime.InteropServices.NFloat -> UIKit.NSLayoutConstraint

Parameters

view1
INativeObject

First view in the constraint.

attribute1
NSLayoutAttribute

Attribute for the first view.

relation
NSLayoutRelation

Relationships between the view1 and the view2.

view2
INativeObject

Second view in the constraint.

This parameter can be null.

This parameter can be null.

attribute2
NSLayoutAttribute

Attribute for the second view.

multiplier
NFloat

Multiplier applied to the second attribute.

constant
NFloat

Constants to add.

Returns

New constraint with the specified parameters.

Attributes

Remarks

Creates a constraint relationship between the view1 and the view2 that satisfies the following linear equation:

attribute1 = multiplier x attribute2 + constant

Applies to