Esempio n. 1
0
        internal LayoutConstraint AddConstraint(IProperty from, LayoutSupport to, Coefficients coefficients = null, NSLayoutRelation relation = default(NSLayoutRelation))
        {
            if (coefficients == null)
            {
                coefficients = new Coefficients();
            }

            from.View.TranslatesAutoresizingMaskIntoConstraints = false;

            var constraint = NSLayoutConstraint.Create(
                from.View,
                from.Attribute,
                relation,
                to.LayoutGuide,
                to.Attribute,
                coefficients.Multiplier,
                coefficients.Constant
                );

            var view = from.View;

            while (view?.Superview != null)
            {
                view = view.Superview;
            }

            _constraints.Add(new Constraint(view, constraint));

            return(constraint);
        }
Esempio n. 2
0
 public LayoutConstraint Equal(LayoutSupport support)
 {
     return(Context.AddConstraint(this, to: support));
 }
Esempio n. 3
0
 public LayoutConstraint GreaterThanOrEqualTo(LayoutSupport support)
 {
     return(Context.AddConstraint(this, to: support, relation: NSLayoutRelation.GreaterThanOrEqual));
 }