Edit

Share via


UIView.Constraints Property

Definition

The constraints used by Auto Layout on this UIView.

[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 6, 0, ObjCRuntime.PlatformArchitecture.All, null)]
public virtual UIKit.NSLayoutConstraint[] Constraints { [Foundation.Export("constraints")] [ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 6, 0, ObjCRuntime.PlatformArchitecture.All, null)] get; }
member this.Constraints : UIKit.NSLayoutConstraint[]

Property Value

The default value is an empty array.

Attributes

Remarks

Auto Layout uses the Constraints of a UIView to lay out its Subviews. These constraints are set with AddConstraint(NSLayoutConstraint) or AddConstraints(NSLayoutConstraint[]).

The P:UIKit.NSLayoutConstraint.DebugDescription property can be helpful in debugging Auto Layout issues.

foreach(var c in mainView.Constraints)
{
    Console.WriteLine(c.DebugDescription);
}              

Applies to

See also