NSLayoutConstraint.ActivateConstraints(NSLayoutConstraint[]) NSLayoutConstraint.ActivateConstraints(NSLayoutConstraint[]) Method

Definition

Activates all of the constraints passed.

[Foundation.Export("activateConstraints:")]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 8, 0, ObjCRuntime.PlatformArchitecture.All, null)]
public static void ActivateConstraints (UIKit.NSLayoutConstraint[] constraints);
static member ActivateConstraints : UIKit.NSLayoutConstraint[] -> unit

Parameters

constraints
NSLayoutConstraint[]

Constraints to activate.

Remarks

This method has the same effect as setting the Active property to true.


var blueView = new ContentView(UIColor.Blue);
view.AddSubview(blueView);

blueView.TranslatesAutoresizingMaskIntoConstraints = false; var blueConstraints = new [] { blueView.LeadingAnchor.ConstraintEqualTo(greenView.LeadingAnchor), blueView.TrailingAnchor.ConstraintEqualTo(greenView.TrailingAnchor), blueView.TopAnchor.ConstraintEqualTo(greenView.BottomAnchor, 10.0f), blueView.HeightAnchor.ConstraintEqualTo(greenView.HeightAnchor), blueView.WidthAnchor.ConstraintEqualTo(greenView.WidthAnchor) };

NSLayoutConstraint.ActivateConstraints(blueConstraints);

Applies to