NSLayoutConstraint.ActivateConstraints(NSLayoutConstraint[]) Метод
Определение
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Активирует все переданные ограничения.
[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
Параметры
- constraints
- NSLayoutConstraint[]
Ограничения для активации.
- Атрибуты
Комментарии
Этот метод имеет тот же эффект, что и установка Active для свойства значения 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);