I'm making a Mac app which needs to know when the user is scrolling the NSScrollView
, however, I can't find any methods like UIScrollView
, which has the following delegate methods:
– scrollViewDidScroll:
– scrollViewWillBeginDragging:
– scrollViewDidEndDragging:willDecelerate:
– scrollViewShouldScrollToTop:
– scrollViewDidScrollToTop:
– scrollViewWillBeginDecelerating:
– scrollViewDidEndDecelerating:
Can I have the similar delegate methods for the App Kit? Thanks in advance.
Kai.
You can monitor a scroll view's changes by monitoring the bounds of it's content view. First set the content view to post its changes with
[contentView setPostsBoundsChangedNotifications:YES];
Then register as an observer of those notifications with
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(boundsDidChange:) name:NSViewBoundsDidChangeNotification object:contentView];