iOS Guides | Samples

MonoTouch.UIKit.NSLayoutConstraint.ActivateConstraints Method

Activates all of the constraints passed.

Syntax

[MonoTouch.Foundation.Export("activateConstraints:")]
[MonoTouch.ObjCRuntime.Introduced(MonoTouch.ObjCRuntime.PlatformName.iOS, 8, 0, MonoTouch.ObjCRuntime.PlatformArchitecture.None, null)]
public static Void ActivateConstraints (NSLayoutConstraint[] constraints)

Parameters

constraints
Constraints to activate.

Remarks

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

C# Example

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);

Requirements

Namespace: MonoTouch.UIKit
Assembly: monotouch (in monotouch.dll)
Assembly Versions: 0.0.0.0