Search code examples
macoscocoansscrollview

How to set NSScrollView to not auto-hide scroller?


When you stop to scroll an NSScrollView, it will auto-hide the scroller.
How can I disable that?
I can not find any property that can change this.


Solution

  • The autohidesScrollers property of NSScrollView is not taken into account for scroll views that use elastic scrolling (the default).
    To permanantly make the scrollers visible, you could set the scrollerStyle to .legacy and autohidesScrollers to false.

    self.collectionView.enclosingScrollView?.scrollerStyle = .legacy
    self.collectionView.enclosingScrollView?.autohidesScrollers = false