How to find out whether NSScrollView is currently scrolling

nsscrollview scroll programmatically
nsscrollview tutorial
nsscrollview doesn't scroll
nsscrollview scroll position
nsscrollview documentview
nsscrollview flipped
nsscrollview scroll to bottom

How can I find out whether my NSScrollView is currently scrolling? On iOS I can use the delegate but despite of googling a lot I can't find a way to do this on the Mac.

Thanks in advance!

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

The notification method

- (void)boundDidChange:(NSNotification *)notification {
    // get the changed content view from the notification
    NSClipView *changedContentView=[notification object];

NSScrollView, The NSScrollView class is the central coordinator for AppKit's scrolling Determining Component Sizes A Boolean that indicates whether the scroll view draws its background. The amount by which the content is currently scaled. A Boolean that indicates whether the scroll view draws its background. var border Type : NSBorder Type A value that specifies the appearance of the scroll view’s border.

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.


NotificationCenter.default.addObserver(self, selector: #selector(scrollViewDidScroll), name: NSScrollView.willStartLiveScrollNotification, object: nil)

How to Disable NSScrollView Scrolling, The NSScrollView class is the central coordinator for AppKit's scrolling machinery , which is composed of this class A Boolean that indicates whether the scroll view draws its background. The amount by which the content is currently scaled. These constants define the position of the find bar in relation to the scroll view. The amount of scroll for an individual "click" of the scroll wheel is too small; it's scrolling a couple of pixels, and I'd rather it scroll an entire line (about 20 pixels). I tried setting nsScrollView.VerticalLineScroll = 30f in the setup code, but this has no apparent effect.

my two cents for OSX mojave / swift 5

 let nc =  NotificationCenter.default

        selector: #selector(scrollViewWillStartLiveScroll(notification:)),
        name: NSScrollView.willStartLiveScrollNotification,
        object: scrollView

        selector: #selector(scrollViewDidEndLiveScroll(notification:)),
        name: NSScrollView.didEndLiveScrollNotification,
        object: scrollView


   @objc func scrollViewWillStartLiveScroll(notification: Notification){
        #if DEBUG
        print("\(#function) ")

    @objc func scrollViewDidEndLiveScroll(notification: Notification){
        #if DEBUG
        print("\(#function) ")

How to know when a UIScrollView is scrolling (moving)., Unlike UIScrollView on iOS, NSScrollView on Mac does not have a handy for you to set to NO if you need to temporarily disable scrolling in your app. If you Google around, you can find several posts on websites like� AppKit is old and is not as convenient as UIKit. But we have to use it on Mac app development. "Scroll a scrollview to top" sounds easy, but actually it isn't. If you assign a documentView to a NSScrollView, you will see it scrolls to the bottom.

How scroll views work on macOS. If you've ever developed an iOS , I don't know about you, but it's happened to me where I've needed to know when a scroll view is currently scrolling, and ONLY when it is scrolling. as scrollViewDidScroll: but these get called if the contentOffset changes. The easiest way to disable scrolling it seems is to subclass NSScrollView and add a BOOL property with a name like scrollingEnabled. Then you can simply override the designated initializers (initWithFrame: and initWithCoder:) and set the ivar of the property to YES as the default value:

NSScrollView, An NSScrollView consists of two parts if you exclude the scroll view itself, The document view is the only thing that you need to provide to get it to work. I won't We now make a subclass of our NSView and set the property� Trying to find a way how to get scroll view's scroll offset using GeometryReader. The view hierarchy I am after is Scrollview with custom view. Custom view (TileCollectionView) defines its size itself (it is custom collection/tile view with fixed number of columns).

UIScrollView Class (UIKit), An NSScrollView allows the user to scroll a document view that's too large to an NSClipView (though it does need to check whether the mouse is outside of its horizontal scroller, whether or not the receiver is currently displaying it, or nil if � Note that the code creates an NSScrollView that completely covers the content area of the window it’s displayed in. It also specifies a vertical scroll bar but no horizontal scroll bar, since this scrolling text view wraps text within the horizontal extent of the NSTextView, but lets text flow beyond the vertical extent of the NSTextView.