开发者

Animating "sliding" in NSOutlineView

开发者 https://www.devze.com 2022-12-16 12:41 出处:网络
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 ro

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号