Tanya Rao
Tanya Rao

Reputation: 11

Change the height of NSScroller in NSScrollView

I have a NSScrollView, which has NSClipView and vertical/horizontal NSScrollers in it.
Now I want to change the height of the vertical scroller so that it occupies only the top half portion of the scroll view. I can not change the height from the size inspector. I tried changing the frame. It didn't work either.
Can someone help me get through this problem? Thankyou in advance!

Upvotes: 0

Views: 306

Answers (2)

Klajd Deda
Klajd Deda

Reputation: 375

Small world.

I ended up cooking a special component for the 8th pure SwiftUI/FRP incarnation of WhatSize.app There are things Swift UI can't really do, so you have to wrap NSView objects as NSViewRepresentable and now they are available to a pure SwiftUI app.

scrollView.scrollerInsets = .init(top: 0.0, left: 0.0, bottom: 14.0, right: 0.0)

So the vertical scroll bars do not stomp over the drag and column resize icon on the bottom in yellow.

This allows WhatSize to display data just as Finder's "as Columns" does.

enter image description here

Upvotes: 0

Carl Lindberg
Carl Lindberg

Reputation: 2972

Since OS X 10.10, NSScrollView has a scrollerInsets property which should be able to position the scroller differently than the scroll view itself, if wanted.

Upvotes: 1

Related Questions