I'm animating frame changes from autolayout. Code to trigger the expand is
shown here. I added QuartzCore.framework to my link libraries, and checked
layer backing for the window's view.

-(void) expand {
    [NSAnimationContext beginGrouping];
    [[NSAnimationContext currentContext] setAllowsImplicitAnimation: YES];
    [[NSAnimationContext currentContext] setDuration:2];
    [NSAnimationContext currentContext].timingFunction =
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];

    [[view animator] removeConstraint:collapseConstraint];

    [[view animator].superview layoutSubtreeIfNeeded];
    [NSAnimationContext endGrouping];
}

The collapseConstraint is a constraint that limits the view to a short
height, however there is another constraint that establishes the height at
its natural height, with a lower priority. collapseConstraint trumps it,
until it's removed, then boom! layout expands it and moves down the views
below.

2 questions:

1. How do I avoid using -setAllowsImplicitAnimation:? From the
documentation, it sounded like using the animator proxy automatically
handled implicit animations, yet if I remove that line, there are no
animations.

2. I added a recording of this expand animation, and the collapse
animation, on youtube here. http://youtu.be/fSu0EqE9mnM

There is significant vertical jitter in the animation of the expanding
view. For example, the horizontal line, which is an NSBox subview at the
top edge of the expanding view, flickers in/out of visibility. The other
lines inside the views that are getting shifted down don't have this
problem. What might cause this? Perhaps some views inside are changing
height as the frame changes?
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to