NSOutlineView通过代码展开

NSOutlineView通过代码展开

本文介绍了NSOutlineView通过代码展开/折叠动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何从代码动画扩展/折叠NSOutlineView树节点吗?

i'm wondering how does one animate the expansion/collapse of an NSOutlineView's tree node from code ?

// this works ok but doesn't animate

NSTreeNode *node = [self.outlineView itemAtRow:self.outlineView.clickedRow];

if([self.outlineView isItemExpanded:node])
{
    [self.outlineView.animator collapseItem:node];
}else{
    [self.outlineView.animator expandItem:node];
}

如果通过默认绘制的箭头展开节点,则大纲视图自然会动画

所以有一种方法...

an outline view naturally animates if you expand a node via the default-drawn arrow
so there IS a way...

推荐答案

我的原始代码还可以,这只是' t在10.7下可用

My original code was OK, this just wasn't available under 10.7

NSOutlineView

NSOutlineView

现在使用以下方法支持通过-animator代理动画:-expandItem :、 -expandItem:expandChildren :、 -collapseItem:和-collapseItem:collapseChildren:。例如,为特定项目的扩展动画:[[outlineView animator] expandItem:item];

The following methods now support being animated via the -animator proxy: -expandItem:, -expandItem:expandChildren:, -collapseItem:, and -collapseItem:collapseChildren:. As an example, to animate the expansion of a particular item: [[outlineView animator] expandItem:item];

这篇关于NSOutlineView通过代码展开/折叠动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-02 02:08