/// <summary> /// Constraint height anchor to an anchor. /// </summary> public static T ConstraintHeightEqualTo <T>(this T view, NSLayoutAnchor <NSLayoutDimension> anchor, LayoutConstraints constraints = default) where T : UIView { var heightConstraint = view.HeightAnchor.ConstraintEqualTo(anchor); if (constraints != null) { constraints.Height = heightConstraint; } heightConstraint.Active = true; return(view); }
/// <summary> /// Constraint width anchor to an anchor. /// </summary> public static T ConstraintWidthEqualTo <T>(this T view, NSLayoutAnchor <NSLayoutDimension> anchor, LayoutConstraints constraints = default) where T : UIView { var widthConstraint = view.WidthAnchor.ConstraintEqualTo(anchor); var test = new UIView(); if (constraints != null) { constraints.Width = widthConstraint; } widthConstraint.Active = true; return(view); }