UIView.Constraints UIView.Constraints Property


The constraints used by Auto Layout on this UIView.

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

Property Value

The default value is an empty array.


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)

Applies to

See also