【发布时间】:2014-01-10 16:24:35
【问题描述】:
向 NSTableView 添加新行后,我想滚动到它。
当该行被添加到表的末尾时,滚动只会滚动到之前是最后一行的行。我最初认为我必须等待动画完成,但这并没有解决我的问题。这是我的代码:
[NSAnimationContext beginGrouping];
[_tableView insertRowsAtIndexes:indexSet withAnimation:NSTableViewAnimationEffectGap];
[[NSAnimationContext currentContext] setCompletionHandler:^{
// Scroll to the first inserted row
NSUInteger firstIndex = [indexSet firstIndex];
[_tableView scrollRowToVisible:firstIndex];
}];
[NSAnimationContext endGrouping];
我该怎么做?
【问题讨论】:
标签: macos cocoa core-animation nstableview