Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I disable horizontal scrolling for an NSScrollView?

I first tried disabled the scroll bar by setting:

scrollView!.hasHorizontalScroller = false

and that successfully worked, but I could still scroll from left to right by using my trackpad. Is there a way to ensure that horizontal scrolling is completely disabled for an NSScrollView object?

like image 340
ra1nmaster Avatar asked Oct 26 '14 20:10

ra1nmaster


1 Answers

Even with a correct content size, I was still able to use two-finger gestures to scroll horizontally a bit before it snaps back into place. To fix this, you can set the elasticity:

scrollView.horizontalScrollElasticity = .None
like image 66
mikepj Avatar answered Oct 06 '22 00:10

mikepj