How to get NSTableView animation delegate events?
In the new 10.7 Lion NSTableView
, you can animate insertion and removal of NSTableCellViews
with sliding animations and the like. (I'm using NSView
-based, not cell-based.)
Now, the problem is, I want to do something when those cell animation开发者_如何学C(s) are finished, except I'm not sure where to set the delegate for this. Is there some standard way this should be done? I've tried:
[[myTableView animator] setDelegate: self];
but that doesn't seem to be what I'm looking for. I'm assuming I should be implementing the NSAnimationDelegate
protocol and looking for animationDidEnd:
…
Is there some other way I should be doing this?
You can try putting something like this before the lines of code that trigger table view animations (inserts, deletes, moves, etc.):
[[NSAnimationContext currentContext] setCompletionHandler:^{
[self tableViewAnimationDidFinish];
}];
// inserts, deletes, etc.
Did you find any other solutions?
精彩评论