Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSOutlineView expand / collapse animation from code

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...

like image 819
Nightbirdsevolve Avatar asked Dec 14 '12 14:12

Nightbirdsevolve


1 Answers

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

Original text from Application Kit Release Notes for OS X v10.8 :

NSOutlineView

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];

like image 196
Nightbirdsevolve Avatar answered Oct 03 '22 05:10

Nightbirdsevolve