FluentLayout / Cirrious.FluentLayout

FluentLayout for Xamarin.iOS - sample uses MvvmCross
Microsoft Public License
148 stars 54 forks source link

Constraints do not work for subview #43

Closed LuoyeAn closed 6 years ago

LuoyeAn commented 6 years ago

hi, i am meeting a constraints issue.

            var cyan = new UIView { BackgroundColor = UIColor.Cyan };
            var red = new UIView { BackgroundColor = UIColor.Red };

            View.AddSubviews(cyan, red);
            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            View.AddConstraints(cyan.FullSizeOf(View, 20));
            View.AddConstraints(red.FullSizeOf(cyan, new Margins(10, 30)));

above code is working.

for my ios project, i want to set the red view as a subview for cyan view. so i changed the code to

            var cyan = new UIView { BackgroundColor = UIColor.Cyan };
            var red = new UIView { BackgroundColor = UIColor.Red };

            View.AddSubview(cyan);
                        cyan.AddSubview(red);

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            View.AddConstraints(cyan.FullSizeOf(View, 20));
                        cyan.AddConstraints(red.FullSizeOf(cyan, new Margins(10, 30)));

The constraints are not woking. then i do not see the red view.

Is something wrong for me? Please check this. Thanks!

LuoyeAn commented 6 years ago

44 Made a pr to fix this issue.