开发者

How to get NSTableView animation delegate events?

开发者 https://www.devze.com 2023-03-27 20:17 出处:网络
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.)

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?

0

精彩评论

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