FluentLayout / Cirrious.FluentLayout

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

AdvancedVerticalStackPanelConstraints UIView extension #24

Closed xleon closed 8 years ago

xleon commented 8 years ago

Vertical stack panel constraints with support for children independent left, right and top margins and a multiplier factor for all margins applied. The multiplier can be useful when dealing with ipad screens. It will respect the global margins specified in the Margins object. The children specific margin will only be applied when it´s bigger than the global margin.

This is tested and it´s been very handy for the app I´m doing. Example:

scrollView.AddConstraints(scrollView.AdvancedVerticalStackPanelConstraints(null,
     childrenLeftMargins: new float[] { 15, 0, 15, 0, 0, 15 },
     childrenTopMargins: new float[] { 15, 5, 15, 5, 8, 15, 22, 8, 8, 28, 28 },
     marginMultiplier: 2f,
     views: scrollView.Subviews)
gshackles commented 8 years ago

Can you add some layouts to the sample project that demonstrate this in action?

xleon commented 8 years ago

Sure.

BTW, the example navigation gets broken once you navigate back from any screen

xleon commented 8 years ago

Done.

captura de pantalla 2016-03-02 17 24 05

gshackles commented 8 years ago

Thanks for adding the sample!

xleon commented 8 years ago

As the "Avanced" version does basically the same but adding margins, I can use the VerticalStackPanelConstraintsjust as a proxy. Please, see the last commit

gshackles commented 8 years ago

I picked out your changes on top of the latest in master since there was a merge conflict here, commit 17e050f

Thanks for contributing!