Animating view transitions with Core Animation (problems with BasicCocoaAnimations sample)
Animating view transitions with Core Animation (problems with BasicCocoaAnimations sample)
- Subject: Animating view transitions with Core Animation (problems with BasicCocoaAnimations sample)
- From: Jim Correia <email@hidden>
- Date: Mon, 13 Oct 2008 18:51:51 -0400
I have some old NSAnimation based code that I'd like to update to use
Core Animation.
Since BasicCocoaAnimations [1] does essentially what I want to do (at
least for starters) I am using that as a starting point.
[1] http://developer.apple.com/samplecode/BasicCocoaAnimations/index.html
Problem #1:
- Animation for -replaceSubview:with: appears to require a layer
backed view tree.
- Certain controls are not supported with layer backed view trees.
- Others work poorly:
- Focus rings are drawn incorrectly for editable NSTextField and
friends [2]
- Non-editable NSTextFields have incorrect anti-aliasing (without
Scott Stevenson's hack)
- NSTokenField has other issues (will be more specific and file a
radar later)
[2] http://skitch.com/jim.correia/2115/
Is there a direct workaround for any of these problems?
The workaround I attempted was to make the view tree in the window
layer backed only during the animation. This leads to problems #2 and
#3.
Problem #2:
If I set view.wantsLayer=YES on the content view of the window before
doing the transitions, they are still not animated. If I force that
subview tree to re-display before sending -replaceSubview:with: to the
animator proxy, the transition is animated.
While this works, forcing a view tree to display is usually the wrong
way to go about things. Is it expected that I need to force display a
view tree after view.wantsLayer=YES if I expect to start implicit
animations on that run loop cycle?
Problem #3:
In order to arrange for my view tree to only be layer backed for the
duration of the animation, I need to know when the animation
finishes :-)
The benefit of the implicit view animations is that much of the heavy
lifting has already been done for me, so I'd like to take advantage of
it if possible. The problem, though, is that since I'm not running the
animations explicitly, I don't know when they are done.
My current hack is to begin the implicit animations in a group, and
use a perform delayed action to cleanup after the animation (based on
the groups interval.)
This feels like a hack though. Is there a better way?
- Jim
_______________________________________________
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