public override void MovedToSuperview()
        {
            base.MovedToSuperview();

            var maxHeightConstraint = NSLayoutConstraint.Create(this, NSLayoutAttribute.Height, NSLayoutRelation.LessThanOrEqual, Superview, NSLayoutAttribute.Height, 0.3f, 0.0f);

            Superview?.AddConstraint(maxHeightConstraint);
        }
Ejemplo n.º 2
0
        public void AddVerticalCenterConstraintToSuperview()
        {
            if (base.Superview == null)
            {
                return;
            }

            var child = this;

            Superview.AddConstraint(NSLayoutConstraint.Create(
                                        Superview,
                                        NSLayoutAttribute.CenterY,
                                        NSLayoutRelation.Equal,
                                        child,
                                        NSLayoutAttribute.CenterY,
                                        multiplier: 1,
                                        constant: 0));
        }