예제 #1
0
        public static NSLayoutConstraint AlignBottomAnchor(this UIView view, NSLayoutYAxisAnchor anchor, float constant)
        {
            var constraint = view.BottomAnchor.ConstraintEqualTo(anchor, -constant);

            constraint.Active = true;
            return(constraint);
        }
예제 #2
0
        /// <summary>
        /// Constraint centreY anchor to an anchor.
        /// </summary>
        public static T ConstraintCentreYEqualTo <T>(this T view, NSLayoutYAxisAnchor anchor, nfloat constant = default, LayoutConstraints constraints = default) where T : UIView
        {
            var centerYConstraint = view.CenterYAnchor.ConstraintEqualTo(anchor, constant);

            if (constraints != null)
            {
                constraints.CenterY = centerYConstraint;
            }
            centerYConstraint.Active = true;
            return(view);
        }
예제 #3
0
        /// <summary>
        /// Constraint bottom anchor to an anchor.
        /// </summary>
        public static T ConstraintBottomEqualTo <T>(this T view, NSLayoutYAxisAnchor anchor, nfloat constant = default, LayoutConstraints constraints = default) where T : UIView
        {
            var bottomConstraint = view.BottomAnchor.ConstraintEqualTo(anchor, -constant);

            if (constraints != null)
            {
                constraints.Bottom = bottomConstraint;
            }
            bottomConstraint.Active = true;
            return(view);
        }
예제 #4
0
        /// <summary>
        /// Constraint top anchor to an anchor.
        /// </summary>
        public static T ConstraintTopEqualTo <T>(this T view, NSLayoutYAxisAnchor anchor, nfloat constant = default, LayoutConstraints constraints = default) where T : UIView
        {
            var topConstraint = view.TopAnchor.ConstraintEqualTo(anchor, constant);

            if (constraints != null)
            {
                constraints.Top = topConstraint;
            }
            topConstraint.Active = true;
            return(view);
        }
예제 #5
0
 void AnchorEqual(NSLayoutYAxisAnchor target, NSLayoutYAxisAnchor host, nfloat margin) => target.ConstraintEqualTo(host, margin).Active = true;