FluentLayout / Cirrious.FluentLayout

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

Expose the constraint generated in FluentLayout to be accesible from outside world #23

Closed xleon closed 8 years ago

xleon commented 8 years ago

With this simple change we gain access to the NSLayoutConstraint. This is needed to animate constraints or any other operation. Please, see my comment here: https://github.com/slodge/Cirrious.FluentLayout/issues/18

This is how I´m using the added property:

_monsterOffVerticalLayout = _monsterOff.Above(ground);

View.AddConstraints(
    ...
    _monsterOffVerticalLayout,
    ...
);

_monsterOffVerticalConstraint = _monsterOffVerticalLayout.Constraint;
_monsterOffVerticalConstraint.Constant = 250 * Multiplier;
UIView.Animate(0.2, 0.0, UIViewAnimationOptions.CurveEaseIn, () => View.LayoutIfNeeded(), () => {});
gshackles commented 8 years ago

Closing this based on the latest changes I've pushed and our discussions

alexsorokoletov commented 8 years ago

@gshackles why Constraint member became internal (referenced commit fc4fe6a has it public)? https://github.com/FluentLayout/Cirrious.FluentLayout/blob/master/Cirrious.FluentLayout/FluentLayout.cs#L107

How do we use Constraint?

alexsorokoletov commented 8 years ago

Finally got it, we can update constraints just by changing FluentLayout object properties! Good work, would be great to add that to the readme.md.

gshackles commented 8 years ago

@alexsorokoletov Yeah good call, we'll get that added to the readme. In the meantime, I wrote up some stuff around the new release here: http://gregshackles.com/fluentlayout-2-5/