5
如何找出我的NSScrollView目前是否正在滾動? 在iOS上,我可以使用委託,但儘管谷歌搜索了很多,我找不到在Mac上執行此操作的方法。如何找出NSScrollView當前正在滾動
在此先感謝!
如何找出我的NSScrollView目前是否正在滾動? 在iOS上,我可以使用委託,但儘管谷歌搜索了很多,我找不到在Mac上執行此操作的方法。如何找出NSScrollView當前正在滾動
在此先感謝!
您可以收到通知NSViewBoundsDidChangeNotification像下面所示
NSView *contentView = [scrollview contentView];
[contentView setPostsBoundsChangedNotifications:YES];
// a register for those notifications on the content view.
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(boundDidChange:)
name:NSViewBoundsDidChangeNotification
object:contentView];
通知方法
- (void)boundDidChange:(NSNotification *)notification {
// get the changed content view from the notification
NSClipView *changedContentView=[notification object];
}
作爲OS X 10.9的還有NSScrollViewWillStartLiveScrollNotification
。它在用戶滾動事件的開始處發佈在主線程上。