• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Layout-triggered animation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Layout-triggered animation


  • Subject: Layout-triggered animation
  • From: Julian <email@hidden>
  • Date: Mon, 14 Apr 2014 14:42:56 -0700

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 (email@hidden)

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:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Layout-triggered animation
      • From: Jakob Egger <email@hidden>
  • Prev by Date: Re: Automatically resize parent view when subviews resize
  • Next by Date: Fast NSArray compare
  • Previous by thread: Re: NSTask: how to launch a binary as if I launched it via terminal?
  • Next by thread: Re: Layout-triggered animation
  • Index(es):
    • Date
    • Thread