2

I have a custom NSView with two NSClipViews. I want to add a vertical scroller for each clipview. The snippet below shows a NSScroller, but it is not drawing any knob or buttons. Interaction is also not possible. NSScroller is a small class, so I am not sure what I am missing here.

required init?(coder: NSCoder)
{
    super.init(coder: coder)

    let width = NSScroller.scrollerWidthForControlSize(NSControlSize.RegularControlSize, scrollerStyle: NSScrollerStyle.Overlay)

    let scroller = NSScroller(frame: NSRect(x: 10, y: 10, width: width, height: 500))
    self.addSubview(scroller)
    scroller.doubleValue = 0.5
    scroller.knobProportion = 0.1
    scroller.needsLayout = true  //no effect
    scroller.needsDisplay = true //no effect
}
user965972
  • 2,489
  • 2
  • 23
  • 39

1 Answers1

2

The missing line:

scroller.enabled = true
user965972
  • 2,489
  • 2
  • 23
  • 39