Animating "sliding" in NSOutlineView
I've done a fair amount of Googling, but still haven't find any proper solution for animating the expansion of NSOutlineView. I'm trying to mimic a "sliding" animation when expanding/collapsing rows. Anyone know a good strat开发者_开发技巧egy for attempting this?
Animating this:
}} Folder 1
To expand and look like this:
}} Folder 1
}}}}} Item 1
}}}}} Item 2
}}}}} Item 3
Take a look at this project: TLAnimatingOutlineview
This is actually very simple, and you don’t need third-party libraries. Instead of calling the expandItem:
/ collapseItem:
directly on your NSOutlineView
instance, you pass them to the animator
proxy object.
NSOutline *outlineView = ...;
id item = ...;
[[outlineView animator] collapseItem:item];
Also note that you can expand/collapse all the cells at once by passing a nil
item.
Documentation: NSAnimatablePropertyContainer Protocol Reference
精彩评论