Exemplo n.º 1
0
        public override void UpdateViewConstraints()
        {
            // update is used only when updating the constant value
            growingButton.UpdateConstraints(make =>
            {
                make.Center.EqualTo(View);
                make.Width.EqualTo(NSNumber.FromNFloat(buttonSize.Width)).PriorityLow();
                make.Height.EqualTo(NSNumber.FromNFloat(buttonSize.Height)).PriorityLow();
                make.Width.LessThanOrEqualTo(View);
                make.Height.LessThanOrEqualTo(View);
            });

            // remake is used when changing constraints
            movingButton.RemakeConstraints(make =>
            {
                make.Height.EqualTo(NSNumber.FromNFloat(100));
                make.Width.EqualTo(movingButton.Height()).MultipliedBy(2.0f);

                if (topLeft)
                {
                    make.Left.EqualTo(View.Left());
                    make.Top.EqualTo(View.Top());
                }
                else
                {
                    make.Right.EqualTo(View.Right());
                    make.Bottom.EqualTo(View.Bottom());
                }
            });

            base.UpdateViewConstraints();
        }