Пример #1
0
        public void SetUp()
        {
            window = new TestWindow(
                new CGRect(0, 0, 400, 400)
                );

            view = new TestView();
            window.AddSubview(view);
        }
Пример #2
0
        public void SetUp()
        {
            window = new TestWindow(
                CGRect.FromLTRB(0, 0, 400, 400)
                );

            viewA = new TestView();
            window.AddSubview(viewA);

            viewB = new TestView();
            window.AddSubview(viewB);

            viewC = new TestView();
            window.AddSubview(viewC);

            Constrain(viewA, (a) =>
            {
                a.Width.Equal(100);
                a.Height.Equal(200);

                a.Top.Equal(a.Superview.Top + 10);
                a.Left.Equal(a.Superview.Left + 10);
            });
        }
Пример #3
0
        public void SetUp()
        {
            window = new TestWindow(
                new CGRect(0, 0, 400, 400)
                );

            view = new TestView();
            window.AddSubview(view);

            Constrain(view, (v) =>
            {
                v.Height.Equals(200);
                v.Width.Equals(200);
            });
        }
Пример #4
0
        public void ReplacingConstraints()
        {
            var view2 = new TestView(
                CGRect.Empty
                );

            window.AddSubview(view2);

            Constrain(view1, view2, (x, y) =>
            {
                x.Top.Equal(x.Superview.Top + 10);
                x.Left.Equal(x.Superview.Left + 10);
                x.Right.Equal(x.Superview.Right - 10);
                x.Height.Equal(200);

                y.CenterX.Equal(x.CenterX);
                y.Top.Equal(x.Bottom);
                y.Width.Equal(x.Width);
            });

            window.LayoutIfNeeded();

            // Should update the view

            var group = Constrain(view2, (view) =>
            {
                view.Height.Equal(100);
            });

            window.LayoutIfNeeded();

            Assert.AreEqual(100, view2.Frame.Height);

            Constrain(view2, (view) =>
            {
                view.Bottom.GreaterThanOrEqualTo(
                    view.Superview.Bottom
                    );
            }, group);

            window.LayoutIfNeeded();

            Assert.AreEqual(190, view2.Frame.Height);
        }