I have a NSOutlineView, and clicking on a row will expand/collapse the item if it's expandable.
if ([self.outlineView isItemExpanded:item]) {
NSLog("Will collapse item : %@", item);
[[self.outlineView animator] collapseItem:item];
}
else {
[[self.outlineView animator] expandItem:item];
}
Expanding the item works as expected, however collapsing the item is not working. I did get the log before executing collapseItem:, and the item is correct. The delegate method - (BOOL)outlineView:(NSOutlineView *)outlineView shouldCollapseItem:(id)item
was not called too.
Have been on this problem for hours. Any ideas what causes this?
I figured it out. Seems the item is collapsable only when - (BOOL)outlineView:(NSOutlineView *)outlineView shouldShowOutlineCellForItem:(id)item
returns YES for that item. Otherwise, you can only expand the item.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With