How to customize NSSegmentedControl?
Asked Answered
C

0

6

Do you have any idea how i can obtain that control subclassing NSSegmentedControl/NSSegmentedControlCell ? -

I've tried to override some methods from NSSegmentedControlCell, but i'm not even close to obtain what I want.

  override func drawSegment(segment: Int, inFrame frame: NSRect, withView controlView: NSView) {

        let bez = NSBezierPath(roundedRect: frame, xRadius: 3, yRadius: 3)
        NSColor.lightGrayColor().set()
        bez.stroke()
        if self.selectedSegment != segment {
            bez.fill()
    }
    //super.drawSegment(segment, inFrame: frame, withView: controlView)
}

override func drawInteriorWithFrame(cellFrame: NSRect, inView controlView: NSView) {
    //
}

drawInteriorWithFrame should let me to draw background how i want (just clearColor, with border), but still it has default lightGrayColor.

Thanks.

Clary answered 18/3, 2016 at 12:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.