I'm working in MonoMac and am attempting to animate the width and height constraint for a control dynamically on a button click. After reading the following pages, I'm assuming that I have to use the Animator proxy of my constraint. However, the following code doesn't seem to get the job done.
NSLayoutConstraint.constant ignoring animation http://cocoa-mono.org/archives/235/using-animator-with-frameorigin/
Code:
// makes sure we animate from 0 to calculated width
double newWidth = ...
widthConstraint.Constant = 0;
var animation = new NSAnimation() { Duration = 0.5, AnimationCurve = NSAnimationCurve.EaseInOut };
widthConstraint.Animations = new NSDictionary("constant", animation);
((NSLayoutConstraint)widthConstraint.Animator).Constant = newWidth;
The result of this is the control has a width of newWidth
but it is not animated--it changes immediately.