Re: Animating NSSplitViewItem with CAAnimation
Re: Animating NSSplitViewItem with CAAnimation
- Subject: Re: Animating NSSplitViewItem with CAAnimation
- From: Éric Trépanier <email@hidden>
- Date: Sat, 23 May 2015 09:47:28 -0400
I’ve been looking at Apple’s Using NSPageController sample code (https://developer.apple.com/library/mac/samplecode/FileCards/Introduction/Intro.html) for an app I’m working on.
However, I was curious how one would go about adapting that code sample to make use of storyboards and an actual split view (as opposed to the fixed two-panes layout that the sample app uses), so I rewrote the app in Swift and split the app’s functionality into distinct view controllers (including an NSSplitViewController instance). You might find the example useful as it illustrates animating the split view to collapse / uncollapse the left pane.
You can see the results here: https://github.com/etrep/FileCards_Swift
Enjoy,
Éric
> Le 2015-05-20 à 04:17, Dragan Milić <email@hidden> a écrit :
>
> I’m trying to use SplitViewController/NSSplitViewItem (both new in OS X 10.10) objects combo to control NSSplitView instances in my application.
>
> First off, even though I’ve got the latest version of Apple documentation installed, it completely omits NSSplitViewItem reference. That class is only mentioned in explanations of related methods of NSSplitViewController, but it’s nowhere really documented. I had to resort to class-dumping the AppKit in order to find out it’s interface. I’ll definitely file a bug for this.
>
> Now, into the subject. NSSplitViewItem implements NSAnimatablePropertyContainer protocol, which means one can use its animator proxy to animate animatable properties. The properly I’m interested in is “collapsed”, so that I can simultaneously animate collapsing/uncollapsing of a couple of subviews/item of the split view. I can easily do that using NSAnimationContext and running animation group(s) with completion handler(s). However, I need more control over animation execution. For example, it may happen a new animation is about to start before while the previous one is still in progress. In such case I need to interrupt/stop the previous animation before starting a new one. There are other situations as well, which require more tight control over animation execution. Simple NSAnimationContext animation group running doesn’t provide such flexibility, so I want to add/remove CAAnimation instances directly. However, NSSplitViewItem doesn’t have any CALayer backing up, so I don’t know how to use CAAnimation with it.
>
> Does anyone know more about this?
>
> -- Dragan
> _______________________________________________
>
> 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
_______________________________________________
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