How to find out whether NSScrollView is currently scrolling
You can receive notification NSViewBoundsDidChangeNotification like shown below
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];
The notification method
- (void)boundDidChange:(NSNotification *)notification {
// get the changed content view from the notification
NSClipView *changedContentView=[notification object];
}
As of OS X 10.9 there is also NSScrollView.willStartLiveScrollNotification
. It's posted on the main thread at the beginning of a user scroll event.
E.g.
NotificationCenter.default.addObserver(self, selector: #selector(scrollViewDidScroll), name: NSScrollView.willStartLiveScrollNotification, object: nil)