NSLayoutConstraint.ActivateConstraints(NSLayoutConstraint[]) Método

Definición

Activa todas las restricciones pasadas.

[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

Parámetros

constraints
NSLayoutConstraint[]

Restricciones que se van a activar.

Atributos

Comentarios

Este método tiene el mismo efecto que establecer la Active propiedad en 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);

Se aplica a